Octal/Absolute mode Permissions
Are specified by adding them in numeric/digit mode, as they are kept in file’s inode. This way previous Permission settings are lost and overwritten by the new ones.
Permissions of a file are stored in inode as bits, and they form a construct of 12 bits as follows:
(3 groups * 3 basic permissions) + 3 special permissions = 12 bits in total
Let’s say we have a file with the following permissions: rs-rSxr–
SUID | SGID | sticky | | | r | w | x | | | r | w | x | | | r | w | x |
1 | 1 | 0 | | | 1 | 1 | 0 | | | 1 | 1 | 1 | | | 1 | 1 | 0 |
22 | 21 | 20 | | | 22 | 21 | 20 | | | 22 | 21 | 20 | | | 22 | 21 | 20 |
4 | 2 | 0 | | | 4 | 2 | 0 | | | 4 | 2 | 1 | | | 4 | 2 | 0 |
6 | | | 6 | | | 7 | | | 6 |
Each permission has a value assigned, to get a clear view, take a look at the tables below:
- Basic Permissions
Octal value | File permission set | Permission details |
0 | — | no permission |
1 | –x | execute only |
2 | -w- | write only |
3 | -wx | write & execute |
4 | r– | read only |
5 | r-x | read & execute |
6 | rw- | read & write |
7 | rwx | read, write & execute |
- Special Permissions
Octal value | Special permissions set | |
1 | Sticky | |
2 | SetGUID/SGID | |
4 | SetUID/SUID |
Usually, octal mode is the fastest and easiest way to set permissions on files/folders, for the example above we have to type in the command line:
chmode -R 6676 /file/location/example.txt
If more guidance is needed or something is missing, fell free to ask.