Chmod calculator
Set permissions with checkboxes, type an octal number like 755, or type a string like rwxr-xr-x. The other forms and a ready-to-copy chmod command update at once, including setuid, setgid and the sticky bit.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Tick the boxes for owner, group and others, or choose a common mode such as 644 or 755.
- Or type the octal number, or the symbolic string, in its box: the checkboxes follow.
- Enter the file name, choose recursive if needed, and copy the command.
How it works
Each class (owner, group, others) has three bits: read 4, write 2, execute 1. Add the bits you want for each class to get one digit. A fourth leading digit holds the special bits: setuid 4, setgid 2, sticky 1.
| Octal |
Symbolic |
Typical use |
| 644 |
rw-r–r– |
regular files |
| 755 |
rwxr-xr-x |
scripts, programs, directories |
| 600 |
rw—–– |
private keys, secrets |
| 700 |
rwx—— |
private directories |
| 1777 |
rwxrwxrwt |
shared temporary directories |
Example
rwxr-xr-x is owner rwx = 4+2+1 = 7, group r-x = 4+1 = 5, others r-x = 5, so the command is chmod 755 file. The symbolic form of the same command is chmod u=rwx,g=rx,o=rx file.
Tips
The leading character of a long listing (- for a file, d for a directory) is not part of the mode; tick Directory only if you want it shown. With -R, the same mode is applied to every file and folder below, which is usually wrong because files and directories need different execute bits.
Frequently asked questions
What do the digits in 755 mean?
There is one digit each for the owner, the group and everyone else. Each digit adds read = 4, write = 2 and execute = 1. So 7 = 4+2+1 (rwx) and 5 = 4+1 (r-x): 755 gives the owner full access and everyone else read and execute.
What is the difference between 644 and 755?
644 (rw-r--r--) lets the owner read and write and everyone else only read, the usual mode for ordinary files. 755 (rwxr-xr-x) adds execute for everyone, which scripts, programs and directories need.
What do setuid, setgid and the sticky bit do?
Setuid (4000) makes an executable run as its owner, and setgid (2000) as its group. On a directory, setgid makes new files inherit the directory's group. The sticky bit (1000) on a directory, as on /tmp, lets only a file's owner delete or rename it. They appear as s, s and t in the execute position, or as S and T when execute is not set.
Why does a directory need the execute bit?
For a directory, execute means permission to enter it and reach the files inside by name. Without it you cannot open anything in the folder even if you can read the listing.
Is 777 a good idea?
Rarely. It gives every user on the system permission to change the file. Start from 644 for files and 755 for directories, and open up only what is needed, preferably by group.