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

Reading Permission Strings

Rwxr-xr-x decoded.

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

Those ten characters at the start of every long listing line looked like nonsense before. Now you know enough to read them. Let's decode them, one group at a time.

Reading Permission Strings
From the video: Reading Permission Strings
  • Ten characters
  • Now you can read them
  • One group at a time

Splitting the string

Take RW dash R dash dash R dash dash. The first character is the type. A dash for a file, D for a directory. Then come three groups of three. The first three are the owner's permissions. The next three are the group's. And the last three are for everyone else. A dash means that permission is missing.

-type: a normal file
rw-owner: read, write
r--group: read only
r--others: read only

Reading real examples

Here are three real examples. Notes dot TXT is RW, R, R. Sam can read and change it, everyone else can only read it. The Documents folder has X everywhere, so anyone can go inside. And the password file, slash ETC slash shadow, can't even be read by Sam.

Terminal
ls -l notes.txt
-rw-r--r-- 1 sam sam 30 Jan  5 09:00 notes.txt
ls -ld Documents
drwxr-xr-x 2 sam sam 4096 Jan  5 09:00 Documents
ls -l /etc/shadow
-rw-r----- 1 root shadow 575 Dec 20 10:00 /etc/shadow

Common patterns

You'll see a few patterns again and again. RW, R, R, for normal files. RWX, RX, RX, for programs and folders. RW, then nothing, for private files, like keys. And RWX, then nothing, for private folders.

keyvalue
rw-r--r--normal file
rwxr-xr-xprogram or folder
rw-------private file
rwx------private folder

Summary

The string is a type, then three groups of RWX, for the owner, the group, and others. A dash means no. Next, changing permissions with CH mod.

Key takeaways
  • type + 3 × rwx
  • owner, group, others
  • - means no
Next up: chmod with Letters — u+x, g-w, o-r