What the three digits of chmod mean
A Unix file mode is a small number with one digit per audience: first the owner, then the group, then everybody else. Each digit adds up read (4), write (2) and execute (1). So 7 means all three, 6 means read and write, 5 means read and execute, and 0 means nothing. A mode of 644 therefore reads: the owner may read and write, everyone else may only read.
Get from boxes to a command
- Tick the permissions you want in the grid. The octal and symbolic fields follow every click.
- Or start from a common mode with one of the buttons, such as 755 for a script or 600 for a private key.
- Already have a value? Type
750into Octal orrwxr-x---into Symbolic and the boxes update. A ten character string fromls -l, like-rwxr-xr-x, works as well. - Enter the file or folder name and, for a whole directory tree, tick the recursive option.
- Press Copy and paste the finished command into your terminal.
Setuid, setgid and the sticky bit
The three extra checkboxes add a fourth, leading digit: setuid is 4, setgid is 2 and sticky is 1. A program with setuid runs with the rights of its owner, which is how passwd can edit protected files. Setgid does the same for the group, and on a folder it makes new files inherit that group. The sticky bit on a folder such as /tmp stops users from deleting files that belong to someone else. In the symbolic form they show up as s and t; a capital S or T means the bit is set but the execute right below it is not.
Modes you will meet again and again
644: normal files, readable by everybody and writable by the owner.755: scripts, programs and folders that others may enter.600and700: private files and folders, as SSH keys require.777: everyone can do everything. Avoid it on a server; fix the owner instead.
Folders need the execute right to be entered, which is why a folder is usually 755 where its files are 644.
Nothing leaves your browser
The calculation is simple arithmetic on the page. File names you type are not uploaded, and the tool never touches your files; it only prints the command for you to run.