Permissions tell UNIX what can be done with a file and by whom.
There are three types of permissions:
These permissions allow...
Each of these permissions can be set for any one of three types of user:
Permissions can be changed using the chmod command. The syntax for
using the chmod command involves using numbers to represent the
different permission values.
Read permission is given the value 4
write permission the value 2
and execute permission 1.
| r | w | x |
| 4 | 2 | 1 |
These values are used to represent the permission for each category of user:
| 1 | execute only |
| 2 | write only |
| 3 | write and execute (1+2) |
| 4 | read only |
| 5 | read and execute (4+1) |
| 6 | read and write (4+2) |
| 7 | read and write and execute (4+2+1) |
Access permissions are set using three digit representation.
For example:
| Owner | Group | World | |
| chmod 664 | rw- | rw- | r-- |
| chmod 755 | rwx | r-x | r-x |
| chmod 764 | rwx | rw- | r-- |
Permissions for files should be set to:
| Owner | Group | World | |
| chmod 664 | rw- | rw- | r-- |
Permissions for folders should be set to:
| Owner | Group | World | |
| chmod 775 | rwx | rwx | r-x |