Each file has in its i-node information concerning the permissions that a user can have on this file.
There are 3 types of permissions:
writing / editing (
x) There are 3 types of access to a file:
by the user (
by the user group (
by others (
The permissions for a file are accessible by the command
ls -l (1st column).
A first character indicates the file type:
The next nine characters give the permissions in the order user, group, and others.
rwxr-x--- means that the user has read, write, and execute permissions, other users
of the group have permissions in read and execute (but not in modification), and the other users (except those of the user group) have no permission.
Modification of the permissions¶
chmod allows to modify the permissions of a file.
For each permission and each access, one can define a bit which is true if access is allowed, false otherwise.
For each type of access, the three permission bits (
rwx) can be grouped into 1 byte:
||reading + writing|
||reading + execution|
||read + write + execution|
chmod accepts two types of arguments for the permissions: either an alphabetic form (
rwx) or a numeric form (0,4,5, etc).
# Use of chmod chmod permission file [file...]
ls -l a # Numeric permission (decimal triplet) chmod 777 a ls -l a chmod 664 a ls -l a # Modification by adding or substracting chmod o+x a ls -l a chmod g-wx a # Absolute permission chmod u=rwx a chmod u=rwx,g=rx,o=r a # a: all chmod a=rwx a