File Permissions
In Linux, file permissions are expressed in a 3 digit octal (base 8) number.
These numbers stand for the following permissions:
- 0 - No access.
- 1 - Search or execute access.
- 2 - Write access.
- 3 - Write plus search or execute access.
- 4 - Read access.
- 5 - Read plus search or execute access.
- 6 - Read and write access.
- 7 - Read, write and search or execute access.
When listing the file permissions ('ls -l'), you will notice that there are 10 file attribute characters:
total 11 drwxr-xr-x 3 ROOT SYS1 0 Mar 12 19:32 tmp drwxrwxrwx 4 ROOT SYS1 0 Mar 12 19:32 usr drwxr-xr-x 2 ROOT SYS1 0 Mar 12 19:32 bin -rwxr--r-- 1 ROOT SYS1 572 Mar 12 19:32 foo -rwxr--r-- 1 ROOT SYS1 640 Mar 12 19:33 abc
The first one indicates the type of file, this is either:
- - - Normal file.
- c - Character special file.
- d - Directory.
- e - External link.
- l - Symbolic link.
- p - FIFO.
- s - Socket file type.
The rest describe the 3 digit access mentioned above for difference user groups and can be a combination of:
- r - Read access.
- w - Write access.
- x - Search or execute access.
The first set of 3 digits is the access for the file owner, the second set of 3 digits is the access for the file group and the last set of 3 digits is the access for anyone else.
So for example, file access of 600 (shown as '-rw-------'), means that the file owner has read and write access, but no-one else has any access.