(permission denied

CIS241

System-Level Programming and Utilities

Linux Permissions

Erik Fredericks, frederer@gvsu.edu
Fall 2025

Based on material provided by Erin Carrier, Austin Ferguson, and Katherine Bowers

CIS241 | Fredericks | F25 | 18-permissions

First, aliases!

Or, how to make your life easier in the Linux world

  • Less keystrokes are good for everybody
  • Short command for a longer series of commands/keys

Add in ~/.bashrc to make it persist!

CIS241 | Fredericks | F25 | 18-permissions

Examples from the internet!

Sourced from https://www.reddit.com/r/linuxquestions/comments/16tgbh9/what_are_your_favorite_aliases_to_use/

Useful:

  • alias up="sudo apt update && sudo apt upgrade"
  • alias clearswap="sudo swapoff -a && sudo swapon -a"
  • alias untar='tar -zxvf '
  • alias eos=ssh username@eos18.cis.gvsu.edu

Oops:

  • alias bim=vim
.

File permissions

Three aspects to permissions:

  • Owner - file owner
  • Group - members of group associated with file
  • Everybody/thing else

Three types of access:

  • Read
  • Write
  • Execute
CIS241 | Fredericks | F25 | 18-permissions

Check permissions:

ls -l

  • Char 0: filetype (directory (d) or file (-) or link (l))
  • Char 1-9: file permissions
  • ACL flag: # links, owner, group, size, mod date, filename

File permissions:

  • rwx: Read, Write, eXecute
  • 3 characters for each (owner, group, other)
    • Example: -rwxr-x---
      • File where owner has full permissions, group has read/execute, other has none
CIS241 | Fredericks | F25 | 18-permissions

File permissions

Also can be written numerically (octal):

  • Read: 4
  • Write: 2
  • Execute: 1

Sum to get the combination (min of 0, max of 7)

rwx : 4+2+1=74 + 2 + 1 = 7
r-x : 4+0+1=54 + 0 + 1 = 5

CIS241 | Fredericks | F25 | 18-permissions
(permissions)
CIS241 | Fredericks | F25 | 18-permissions
(permissions)
CIS241 | Fredericks | F25 | 18-permissions

Modifying permissions

chmod

  • + : add permission
  • - : remove permission

Examples:

  • chmod u+x filename
    • Give filename owner execute permission
  • chmod o+rw filename
    • Give filename other (not owner/group) read/write permission
  • chmod 755 filename
    • Give filename rwx r-x r-x permission
CIS241 | Fredericks | F25 | 18-permissions
(environment)

Environment variables

PATH: where shell looks for programs to execute

  • You may have had to modify PATH in the past for things like, 'where is Java?' (or Python)

To modify:

  • Open ~/.bashrc
  • add export PATH="newpath:$PATH"
    • Adds your newpath onto the existing $PATH string

Searched in the order listed

How to check $PATH specifically?

Print all environment variables - printenv

CIS241 | Fredericks | F25 | 18-permissions

Installing software from source

Why do this?

  • Working through an example: sl

  • First, let’s clone the repo:

    • git clone git@github.com:mtoyoda/sl.git
  • If you don’t have ssh keys setup on EOS:

    • git clone https://github.com/mtoyoda/sl
  • Build the application, if necessary

  • Modify PATH to include this directory

CIS241 | Fredericks | F25 | 18-permissions

echo $PATH or to be cute, printenv | grep PATH