What it does
The chmod calculator converts Unix and Linux file permissions between the three ways people write them: a grid of read, write and execute checkboxes, an octal number such as 755, and a symbolic string such as rwxr-xr-x. It also writes the matching chmod command in both octal and symbolic form, explains who can do what, and supports the special setuid, setgid and sticky bits. Everything runs in your browser.
How to use
- Tick the checkboxes for the owner, the group and others, or type a mode into the box. The box accepts octal (
644,0644,4755),ls -lstyle strings (rw-r--r--or-rw-r--r--with the file type in front) and chmod expressions such asu=rwx,g=rx,o=ora+x. - The checkboxes and the results follow whatever you type, and ticking a box rewrites the mode in the same notation.
- Set the file name under Options and turn on Recursive (-R) if you want to apply the mode to a whole directory tree. Copy the finished command with one click.
Common modes
chmod 755 deploy.sh # rwxr-xr-x
chmod 644 index.html # rw-r--r--
chmod 600 ~/.ssh/id_ed25519 # rw-------
chmod 1777 /tmp # rwxrwxrwt
- 755 for directories, scripts and programs: the owner can change them; everyone can read and run them.
- 644 for normal files such as web pages and images.
- 600 for private files such as SSH keys and
.envfiles: only the owner can read them. SSH refuses keys that others can read. - 700 for private directories and 775/664 when a group of users shares a project.
How the numbers work
Each class of user gets one octal digit made by adding read = 4, write = 2 and execute = 1. On a directory, read means listing its names, write means creating and deleting files inside it, and execute means entering it or reaching files inside.
An optional leading digit holds the special bits: setuid = 4, setgid = 2, sticky = 1. In symbolic form they replace the execute letter: s for setuid and setgid and t for sticky. A capital S or T means the special bit is set but execute is not, which is almost always a mistake.
The calculator also shows the equivalent umask, the bits a default umask removes from 777 to produce the mode. A umask of 022 gives 755 directories and 644 files.
FAQ
› What does chmod 755 mean?
Each digit is one class of user: owner, group and others. 7 = read (4) + write (2) + execute (1); 5 = read + execute. So 755 lets the owner do everything and everyone else read and run the file, written rwxr-xr-x. It is the usual mode for scripts and directories.
› What is the difference between 644 and 755?
644 (rw-r--r--) has no execute bit, so it suits ordinary files such as HTML, images and configuration. 755 adds execute for everyone, which programs need to run and directories need so that people can enter them.
› Why is chmod 777 a bad idea?
777 gives every user on the system permission to change or replace the file. On a web server that means any compromised process can rewrite your code. Fix ownership with chown instead, and use 755 for directories and 644 for files.
› What are setuid, setgid and the sticky bit?
They are a fourth, leading octal digit. setuid (4) makes a program run as its owner, setgid (2) runs it as its group or makes new files in a directory inherit the group, and the sticky bit (1) stops users from deleting other people's files in a shared directory such as /tmp. In ls output they appear as s and t in the execute positions.