Linux permissions control:
- Who can access files
- Who can modify files
- Who can execute programs
Permissions are one of the most important Linux security features.
Permission Types
| Symbol | Meaning | Value |
|---|---|---|
| r | Read | 4 |
| w | Write | 2 |
| x | Execute | 1 |
Check Permissions
Use:
ls -l
Example Output
- rwxr-xr-- 1 aryan dev 1200 file.sh
Permission Breakdown
- rwxr-xr--
Split into:
- rwx r-x r--
Meaning
| Part | Who |
|---|---|
| rwx | Owner permissions |
| r-x | Group permissions |
| r-- | Others permissions |
First Character Meaning
| Symbol | Type |
|---|---|
| - | Regular file |
| d | Directory |
| l | Link |
Read Permission (r)
File
Allows viewing content.
Example:
cat file.txt
Directory
Allows listing files.
Example:
ls folder
Write Permission (w)
File
Allows:
- Edit
- Modify
- Delete contents
Directory
Allows:
- Create files
- Delete files
- Rename files
Execute Permission (x)
File
Allows running file as program/script.
Example:
./script.sh
Directory
Allows entering directory.
Example:
cd folder
Permission Groups
Linux permissions apply to:
| Group | Meaning |
|---|---|
| User (u) | Owner |
| Group (g) | Group members |
| Others (o) | Everyone else |
Example
- rwxr-x---
Meaning:
| User | Permission |
|---|---|
| Owner | Read, Write, Execute |
| Group | Read, Execute |
| Others | No access |
Numeric Permission System
| Permission | Value |
|---|---|
| r | 4 |
| w | 2 |
| x | 1 |
Example
755
Means:
| User | Permission |
|---|---|
| Owner | rwx (7) |
| Group | r-x (5) |
| Others | r-x (5) |
Top comments (0)