Table of Contents
Managing file permissions is a core part of Linux administration.
Every file and directory in Linux has permissions that determine who can read, write, or execute it.
🧱 The Basics
Before we look at the ls -l command, here’s a quick visual overview of how Linux file permissions work 👇
Linux File Permissions — how read, write, and execute bits map to owner, group, and others.
Each file or directory in Linux has a 10-character permission string shown when you run ls -l:
-rwxr-xr-x 1 user group 1234 Oct 23 10:00 file.sh
Let’s decode it step by step 👇
| Character | Meaning |
|---|---|
- |
File type (- = regular file, d = directory, l = symbolic link) |
r |
Read — view file contents |
w |
Write — modify contents |
x |
Execute — run (for files) or enter (for directories) |
👤 Owner, Group, and Others
Linux permissions are divided into three sections:
| Section | Applies To | Example |
|---|---|---|
rwx |
Owner | The file’s creator |
r-x |
Group | Users in the same group |
r-x |
Others | Everyone else |
So this line:
-rwxr-xr-x
means:
- Owner: read, write, execute
- Group: read, execute
- Others: read, execute
🔢 Numeric Permissions Explained
Permissions can also be represented numerically using the following values:
| Permission | Value | Symbol |
|---|---|---|
| Read | 4 | r |
| Write | 2 | w |
| Execute | 1 | x |
To calculate the numeric value:
rwx= 4 + 2 + 1 = 7r-x= 4 + 0 + 1 = 5rw-= 4 + 2 + 0 = 6
Hence, 755 equals rwxr-xr-x.
Formula breakdown:
Owner: 7 (rwx)
Group: 5 (r-x)
Others: 5 (r-x)
⚙️ Common Permission Modes
Here are the most commonly used permission settings:
| Mode | Symbolic | Meaning |
|---|---|---|
| 777 | rwxrwxrwx | Everyone can read, write, and execute |
| 755 | rwxr-xr-x | Owner full access; Group & Others read/execute |
| 644 | rw-r–r– | Owner read/write; Group & Others read only |
| 600 | rw——- | Owner only (private file) |
🧰 Using chmod
You can change permissions with the chmod command:
chmod 755 file.sh # rwxr-xr-x
chmod u+x script.sh # add execute permission for the user
ls -l file.sh # view detailed permissions
If the first character is d, it’s a directory — for example:
drwxr-xr-x
That means it’s a directory, and the x bit allows users to enter it (cd directory).
🧠 Quick Tips
xon a file → allows running it.xon a directory → allows entering it.- Execute on directories controls traversal, not execution.
💡 Try It Yourself (Hands-On)
Let’s test this in your terminal:
touch test.sh
chmod 755 test.sh
ls -l test.sh
You should see:
-rwxr-xr-x
✅ That means you (the owner) can read, write, and execute the file.
⚡ Summary
- Linux permissions control who can read, write, or execute files and directories.
- Permissions are grouped into owner, group, and others.
- You can use either symbolic (rwx) or numeric (755, 644) notation.
- Use
chmodto modify permissions easily.
Start the conversation