What it does
Unix and Linux file permissions are stored as a number. Each digit describes one class of user (owner, group, other) and is the sum of read (4), write (2) and execute (1). So 7 means read, write and execute, 5 means read and execute, and 4 means read only.
Common values
644(rw-r--r--): normal files that only the owner may edit.755(rwxr-xr-x): programs and directories others may enter.600(rw-------): private files such as SSH keys.777(rwxrwxrwx): everyone can do everything. Avoid it on servers.
Special bits
A fourth leading digit adds setuid (4), setgid (2) and the sticky bit (1). They appear as s or t in the symbolic form, or as capital letters when the matching execute bit is off.
Using the result
Tick the boxes or type an octal value; the symbolic form and both commands update together. chmod 755 filename sets the exact mode, and the symbolic command chmod u=rwx,g=rx,o=rx filename does the same. When a special bit is set, the symbolic command ends with u+s, g+s or +t because those bits are not part of the u=, g= and o= sets. Replace filename with your path.
Common mistakes
- Directories need execute. On a directory, read lets you list names, write lets you add or remove entries, and execute lets you enter it, so a directory is usually
755or700, not644. - Recursive chmod.
chmod -R 755 dirgives every file the execute bit too. Set directories and files separately when you only want directories to be enterable. - Keys that are too open. OpenSSH refuses a private key that other users can read, so use
600for the key and700for the~/.sshdirectory. - Scripts. A script needs the execute bit before you can run it directly or schedule it; for the schedule itself see the Cron Expression Explainer.
To see how an octal digit maps to bits, convert it with the Number Base Converter: 7 is 111, 5 is 101 and 4 is 100 in binary.
Common permissions
Each digit is the sum of read (4), write (2) and execute (1), for the owner, the group and everyone else in that order. These are the results of the calculator:
644isrw-r--r--, commandchmod 644 filename: the owner can read and write, others can only read. The usual mode for files.755isrwxr-xr-x: the owner has everything, others can read and execute. The usual mode for directories and scripts.600isrw-------, symbolic commandchmod u=rw,g=,o= filename: only the owner has access. Use it for private keys and secrets.777isrwxrwxrwx: everyone can do everything. Avoid it, because any user on the machine can change the file.
Special bits
4755isrwsr-xr-x. The setuid bit (the s in the owner’s triplet) makes the program run with the permissions of its owner. Use it only when it is really needed.1777isrwxrwxrwt. The sticky bit (the t at the end) on a shared directory such as /tmp means that users can delete only their own files there.- The setgid bit makes new files in a directory inherit its group, or makes a program run with its group’s permissions.
Frequently asked questions
What does execute mean for a directory?
It means permission to enter the directory and to reach the files inside it. Without it, the files cannot be opened even if they are readable.
Why does SSH complain about my private key?
SSH refuses private keys that other users can read. Set it to 600 and the ~/.ssh directory to 700.
Is chmod -R safe?
It applies the same mode to every file and directory below, which is rarely what you want, because files and directories need different modes. Set directories and files separately.
Is my input sent anywhere?
No. The calculation runs in your browser.
Privacy
This tool runs entirely in your browser. What you enter is processed on your device and is not sent to a server.