chmod calculator
Type 755, paste -rw-r--r-- from ls -l, or tick the boxes. Every form stays in sync, and you see what the mode means for a file and for a directory.
chmod 755 = rwxr-xr-x: owner full access, everyone else read and execute.
| Read 4 | Write 2 | Execute 1 | Digit | |
|---|---|---|---|---|
| Owner (user) | 7 | |||
| Group | 5 | |||
| Others | 5 | |||
| Special | 0 |
7Owner (user): 7 = 4 read + 2 write + 1 execute5Group: 5 = 4 read + 1 execute5Others: 5 = 4 read + 1 execute
On a file
- Owner (user) read it, change it and run it as a program
- Group read it and run it as a program
- Others read it and run it as a program
On a directory
- Owner (user) list the names inside, enter it and open files by name, create and rename and delete entries
- Group list the names inside and enter it and open files by name
- Others list the names inside and enter it and open files by name
chmod 755 filechmod u=rwx,go=rx filels -l → -rwxr-xr-x
What does a chmod command do to a mode?
Symbolic operations follow GNU chmod: X adds execute only to directories and files that already have it, and with no u, g, o or a the umask decides which bits + may set.
umask calculator
| umask | New files | New directories | umask -S |
|---|---|---|---|
022 | 644 rw-r--r-- | 755 rwxr-xr-x | u=rwx,g=rx,o=rx |
002 | 664 rw-rw-r-- | 775 rwxrwxr-x | u=rwx,g=rwx,o=rx |
027 | 640 rw-r----- | 750 rwxr-x--- | u=rwx,g=rx,o= |
077 | 600 rw------- | 700 rwx------ | u=rwx,g=,o= |
New files start from 666 and directories from 777; the umask removes bits. Programs can ask for less (an SSH key is created 600 whatever the umask).
Permission modes, explained
- chmod 755 (rwxr-xr-x)
- chmod 644 (rw-r--r--)
- chmod 777 (rwxrwxrwx)
- chmod 600 (rw-------)
- chmod 700 (rwx------)
- chmod 400 (r--------)
- chmod 664 (rw-rw-r--)
- chmod 775 (rwxrwxr-x)
- chmod 750 (rwxr-x---)
- chmod 640 (rw-r-----)
- chmod 4755: setuid (rwsr-xr-x)
- chmod 2775: setgid directory (rwxrwsr-x)
- chmod 1777: sticky bit (rwxrwxrwt)
- 755 vs 644
- 600 vs 644
- chmod +x
- chmod X (capital X)
- umask 022
- umask 002
- umask 077