AI Hints
Home›Linux Tutorial›Changing Permissions
Linux · Lesson 66 of 120

chmod with Numbers

755, 644 and 600.

⏱ 2 min read▶ Video at 1:26:17🎓 Free
Watch this lesson in the Linux courseWatch on YouTube ↗Full Linux course

Online, you'll often see commands like CH mod seven five five. Those numbers look magical, but they're just simple arithmetic. Each permission has a value.

chmod with Numbers
From the video: chmod with Numbers
  • chmod 755?
  • Looks magical
  • Just simple arithmetic

The values

Read is worth four. Write is worth two. Execute is worth one. Add up the permissions you want, and you get a single digit. Seven is four plus two plus one, which is everything. Five is four plus one, read and execute. Six is four plus two, read and write.

r = 4read
w = 2write
x = 1execute
7 = 4+2+1rwx

Three digits, three groups

Three digits set all three groups at once. Owner first, then group, then others. CH mod six four four gives RW, R, R. Seven five five gives RWX, RX, RX. And six hundred makes a file completely private.

Terminal
chmod 644 notes.txt && ls -l notes.txt
-rw-r--r-- 1 sam sam 30 Jan  5 09:00 notes.txt
chmod 755 projects/scripts/hello.sh && ls -l projects/scripts/hello.sh
-rwxr-xr-x 1 sam sam 40 Jan  5 09:00 projects/scripts/hello.sh
chmod 600 todo.txt && ls -l todo.txt
-rw------- 1 sam sam 58 Jan  5 09:00 todo.txt

Numbers you will meet

These four numbers cover almost everything. Six four four for normal files. Seven five five for scripts, programs, and folders. Six hundred for private files, like SSH keys. And seven hundred for private folders. If you ever see seven seven seven, be suspicious. It lets anyone change the file.

NumberLettersUsed for
644rw-r--r--normal files
755rwxr-xr-xscripts, folders
600rw-------private files, keys
700rwx------private folders
777rwxrwxrwxalmost never!

Summary

Four for read, two for write, one for execute. Add them up for each group. Six four four, seven five five, and six hundred cover most needs. Next, running your own script.

Key takeaways
  • r4 w2 x1
  • 644 / 755 / 600
  • Avoid 777
Next up: Running a Script — chmod +x and ./