Free tool · Linux
Linux chmod Calculator
Tick the permissions you want and get the octal number, the symbolic form and a ready-to-paste chmod command. Or type a number such as 755 to see what it allows.
Permissions
| Who | Read | Write | Execute |
|---|---|---|---|
| Owner | |||
| Group | |||
| Others |
Result
chmod 644 filenameHow chmod numbers work
Every file and directory on Linux has three sets of permissions: one for the owner, one for the group and one for everyone else. Each set is a single digit made by adding three values together.
| Permission | Letter | Value | On a file | On a directory |
|---|---|---|---|---|
| Read | r | 4 | View the contents | List the files inside |
| Write | w | 2 | Change the contents | Create, rename and delete files inside |
| Execute | x | 1 | Run it as a program | Enter it and reach the files inside |
So 7 is read + write + execute (4 + 2 + 1), 6 is read + write, 5 is read + execute and 4 is read only. Three digits side by side give the full permission: 754 means the owner gets 7, the group gets 5 and others get 4.
Common permissions and when to use them
| Number | Symbolic | Typical use |
|---|---|---|
644 | -rw-r--r-- | Ordinary files: web pages, images, configuration without secrets |
755 | -rwxr-xr-x | Directories, and scripts or programs that others may run |
600 | -rw------- | Private files: SSH private keys, files with passwords |
700 | -rwx------ | Private directories such as ~/.ssh, private scripts |
664 | -rw-rw-r-- | Files a team edits together through a shared group |
775 | -rwxrwxr-x | Shared project directories |
400 | -r-------- | Read-only secrets, for example a cloud key file |
The special bits
setuid
On a program, setuid makes it run with the permissions of the file's owner, not the user who started it. passwd uses this so ordinary users can change their own password. It shows as an s in the owner's execute position.
setgid
On a directory, setgid makes new files inherit the directory's group, which keeps shared folders consistent. It shows as an s in the group's execute position.
Sticky bit
On a shared directory such as /tmp, the sticky bit lets users delete only their own files. It shows as a t in the last position.
Frequently asked questions
What does chmod 755 mean?
chmod 755 gives the owner read, write and execute permission, and gives the group and everyone else read and execute permission. It is the usual setting for directories and for scripts that other users need to run.
What does chmod 644 mean?
chmod 644 lets the owner read and write the file, while the group and everyone else can only read it. It is the usual setting for ordinary files such as web pages and configuration files that hold no secrets.
Why is chmod 777 a bad idea?
chmod 777 lets every user on the system read, change and run the file. On a server that means any compromised account or service can modify it. Use the smallest permission that works, such as 755 for directories and 644 for files.
How do I apply a permission to a folder and everything inside it?
Add the -R option, for example chmod -R 755 foldername. Be careful: this sets the same permission on files and directories alike. Files rarely need execute permission, so many administrators set directories to 755 and files to 644 separately.