By · Updated

Chmod Cheat Sheet

Linux Permission Numbers, Common Modes Like 644 and 755, and Special Bits

No ratings yet

Loading…

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Chmod Cheat Sheet works

This chmod cheat sheet puts Unix file permissions on one page: what each octal digit from 0 to 7 means, the common modes such as 644, 755 and 600 with what they are for, the special setuid, setgid and sticky bits, and the symbolic chmod commands. Use the chmod calculator linked below to build any other mode.

Reading a chmod cheat sheet

A mode such as 755 is three octal digits: one each for the owner, the group and everyone else. Each digit is the sum of read (4), write (2) and execute (1), so 7 is all three, 5 is read and execute, and 4 is read only. The symbolic column shows the same thing as ls -l does, three characters per digit.

Execute on a directory

On a file, execute means the file can be run. On a directory it means the directory can be entered and its files reached by name, and read only lets you list the names. That is why directories are almost always 755 or 700 while the files inside are 644 or 600; a directory with 644 cannot be used at all by anyone but root.

The special bits

A fourth digit in front sets the special bits. Setuid (4) makes an executable run as its owner, which is how passwd can write the password file. Setgid (2) does the same for the group, and on a directory makes new files inherit the directory's group. The sticky bit (1) on a shared directory such as /tmp stops users deleting each other's files.

FAQ

What is the difference between chmod 755 and 644?

755 gives the owner read, write and execute and everyone else read and execute; 644 gives the owner read and write and everyone else read only. Use 755 for directories and scripts that must run, and 644 for ordinary files such as web pages, images and configuration.

Is chmod 777 ever safe?

Rarely. 777 lets every user on the system change or replace the file, so on a web server it lets any compromised process rewrite your code. When something only works at 777, the real fix is almost always to change the file's owner or group with chown, then use 775 or 755.

Can I print or reuse this permissions table?

Yes. Print it for the wall, or download the CSV or JSON for your team's documentation. The table is written by OneTask and released under CC0, so you can copy it into anything without a licence or credit.

See also: all Tech Data tools, Everyday Data.

Related tools