Chmod calculator
Tick read, write and execute boxes or type 755 or rwxr-xr-x, and get the matching octal, symbolic and chmod command, explained.
Questions
What do the digits in 755 mean?
Each digit is one class: owner, group, then others. Read is 4, write is 2 and execute is 1, added together. So 7 is read, write and execute, and 5 is read and execute.
What is the fourth digit, as in 4755?
It holds the special bits: 4 is setuid, 2 is setgid and 1 is the sticky bit. In ls -l they show as s or t in place of x, in capitals when the matching execute bit is off.
Which mode should I use?
Common choices are 644 for regular files, 755 for scripts and directories, 600 for private files such as SSH keys, and 700 for private directories. Avoid 777, which lets anyone change the file.