Skip to content

chmod with numbers: 644, 755 and 600

Learn what chmod 755, 644 and 600 mean, how r=4, w=2 and x=1 add up, and set octal permissions yourself in a practice terminal in your browser.

Lesson 11 of 166 minSkip to the terminal ↓

Instead of letters, chmod also takes three digits: one for the user (owner), one for the group and one for others. Each digit is a sum:

PermissionValue
read (r)4
write (w)2
execute (x)1

So 7 = 4 + 2 + 1 = rwx, 6 = 4 + 2 = rw-, 5 = 4 + 1 = r-x, 4 = r-- and 0 = ---.

The ones you'll see most

ModeLettersTypical use
644rw-r--r--ordinary files: you edit, everyone reads
600rw-------private files: only you read or write
755rwxr-xr-xprograms, scripts and directories: you change, everyone runs or enters
700rwx------private scripts or directories
chmod 600 diary.txt
ls -l diary.txt

The digits set all nine permissions at once, while letters like u+x change just one. Both are fine; numbers are quicker when you know the result you want.

You'll sometimes see chmod 777 suggested to "fix" a permission error. It lets everyone change and run the file. It's almost never the right answer.

Your task

Make diary.txt private (only you can read and write it: rw-------), make scripts/deploy.sh 755 (rwxr-xr-x), and let everyone read public/index.html while only you can change it (rw-r--r--).

  • diary.txt is 600 (rw-------) (not done yet)
  • scripts/deploy.sh is 755 (rwxr-xr-x) (not done yet)
  • public/index.html is 644 (rw-r--r--) (not done yet)

Lesson 11 of 16.

learner@sandbox: ~bash (practice)
Note: Practice shell for this lesson. Type a command and press Enter (help lists them all).