How chmod numbers work
Each permission has a value: read is 4, write is 2 and execute is 1. Add them up for each of the three classes, owner, group and everyone else (public), and you get one digit per class. Tick the boxes above and the calculator shows the octal number, the symbolic form and a ready-to-paste chmod command.
rwx = 4 + 2 + 1 = 7 rw- = 4 + 2 = 6 r-x = 4 + 1 = 5 r-- = 4 = 4 chmod 754 file → owner rwx, group r-x, public r--
Common chmod values
644 rw-r--r-- regular files: web pages, images, most config files 755 rwxr-xr-x directories, scripts and programs others may run 600 rw------- private files: SSH private keys, .env files 700 rwx------ private directories, such as ~/.ssh 777 rwxrwxrwx anyone can change or replace it: avoid
On a directory, execute means permission to enter it and reach the files inside, which is why directories are usually 755 or 700 rather than 644. SSH refuses to use a private key that other users can read, so keys need 600.
Setuid, setgid and the sticky bit
- A fourth digit in front sets the special bits: setuid is 4, setgid is 2 and the sticky bit is 1. The calculator adds it when you tick them.
- Setuid (
4755): the program runs with its owner's permissions.passwduses it to update a file only root can write. Avoid it on your own scripts. - Setgid (
2775): on a directory, new files take the directory's group, which helps shared project folders. - Sticky bit (
1777): in a shared directory such as/tmp, people can delete only their own files.
Octal or symbolic?
This calculator writes the octal form, which sets every permission at once. chmod also accepts symbolic changes that adjust one thing and leave the rest alone: chmod u+x deploy.sh makes a script executable for its owner, chmod g-w file removes group write, and chmod -R 755 dir applies a value to a folder and everything in it.