Access Rights

  • Every user has a unique username and is member of 1+ groups.

  • Every file and directory has a owner, a group and a set of permission flags.

  • Flags specify permissions:

    • read, write and execute(rwx)

    • owner, group and others (ugo).

  • Programs need to have execute (x) permission to run in shell

ls -lt

Permissions are controlled with the commands chmod, chown, chgrp

  • Only owner can change permissions of a file

chmod

  • chmod has 2 different syntaxes

Syntax 1

  • assign (=), gives(+), or take away(-) permission

  • who corresponds to --> u (user), g (group), o (other)

  • permission corresponds to --> read (r), write (w), execute (x)

    • chmod who=permission

    • chmod who+permission

    • chmod who-permission

 ls -l catfile.txt
 chmod g=rwx catfile.txt
 ls -l catfile.txt
 ls -l catfile.txt
 chmod g-w catfile.txt
 ls -l catfile.txt
 ls -l catfile.txt
 chmod o+x catfile.txt
 ls -l catfile.txt

chmod n

  • numeric shortcuts to change mode in a compact way.

  • format: chmod n filename

    • n is a 3 digit number, values from 0 to 7

    • each digit is associated to user, group, other

  • examples:

ls -l catfile.txt
chmod 644 catfile.txt
ls -l catfile.txt
chmod 700 catfile.txt
ls -l catfile.txt

Last updated

Was this helpful?