About linux file permission calculator
Convert between the symbolic form shown by ls -l, such as -rwxr-xr--, and the numeric form used by chmod, such as 754.
Reading the string
- The first character is the type: - for a file, d for a directory, l for a link.
- Then three groups of rwx for owner, group and others.
Directories
For directories, execute means permission to enter it, and read means permission to list it.
A worked example
-rwxr-xr-- reads as a regular file where the owner has rwx (7), the group has r-x (5) and others have r-- (4), so it is 754. A d at the start, as in drwxr-xr-x, marks a directory. Converting in both directions helps when a guide uses one form and ls shows the other.
Special bits
- setuid (4000) runs a file as its owner.
- setgid (2000) keeps group ownership on new files in a directory.
- The sticky bit (1000) lets only owners delete files in a shared folder such as /tmp.
