Guide

Chmod 755, 644 and 600: Linux File Permissions Explained

Short answer: chmod 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. 600 gives the owner alone read and write. If you would rather tick boxes than do the arithmetic, the Chmod Calculator shows the octal value, the symbolic form and a ready-to-run command together.

How the numbers work

Unix and Linux store permissions as a number. There is one digit for each class of user, in this order: owner, group, other. Each digit is the sum of three values:

  • read = 4
  • write = 2
  • execute = 1

So 7 is 4+2+1 (read, write, execute), 5 is 4+1 (read, execute), and 4 is read only. To see the bits behind a digit, convert it with the Number Base Converter: 7 is 111, 5 is 101 and 4 is 100.

The values you will use most

Octal Symbolic Typical use
644 rw-r--r-- Normal files that only the owner may edit
755 rwxr-xr-x Programs, scripts and directories others may enter
600 rw------- Private files such as SSH keys
777 rwxrwxrwx Everyone can do everything. Avoid it on servers

chmod 755 filename sets the exact mode. The symbolic form chmod u=rwx,g=rx,o=rx filename does the same thing.

What "execute" means on a directory

This is the part people get wrong. On a directory, read lets you list the names, write lets you add or remove entries, and execute lets you enter it and reach the files inside. Without execute, the files cannot be opened even if they are readable. That is why a directory is usually 755 or 700, not 644.

Three common mistakes

  1. Recursive chmod. chmod -R 755 dir gives every file the execute bit as well. Set directories and files separately if you only want directories to be enterable.
  2. Keys that are too open. OpenSSH refuses a private key that other users can read. Use 600 for the key and 700 for the ~/.ssh directory. Keep such files out of version control too: see the .gitignore guide.
  3. Scripts without execute. A script needs the execute bit before you can run it directly or schedule it. For the schedule, see the cron expression guide.

Special bits: setuid, setgid and sticky

A fourth, leading digit adds special bits: setuid (4), setgid (2) and sticky (1). They show up as s or t in the symbolic form.

  • 4755 is rwsr-xr-x. The setuid bit makes a program run with the permissions of its owner. Use it only when it is really needed.
  • 1777 is rwxrwxrwt. The sticky bit on a shared directory such as /tmp means users can delete only their own files there.
  • setgid makes new files in a directory inherit its group, or makes a program run with its group's permissions.

How to calculate chmod 755 and other modes with the Chmod Calculator

  1. Open the Chmod Calculator.
  2. Tick the read, write and execute boxes for owner, group and other, or type an octal value such as 755.
  3. Copy the octal, symbolic or command form.
  4. Replace filename with your real path before you run it.

Limits to know

  • It builds the command text. It does not change any file.
  • Check the path before running chmod, especially with -R.
  • Everything runs in your browser.

Frequently asked questions

What does chmod 755 mean? Owner: read, write, execute. Group and others: read and execute.

What is the difference between 644 and 600? 644 lets everyone read the file. 600 lets only the owner touch it.

Why does SSH say my private key is too open? Other users can read it. Set the key to 600 and ~/.ssh to 700.

Is chmod 777 ever a good idea? Rarely. Any user on the machine can change the file.

Is chmod -R safe? It applies one mode to everything below, which is seldom what you want.

Related tools and guides