🔐 Linux File Permissions (chmod Explained Simply)
Linux uses permissions to control:
- Who can read files
- Who can edit files
- Who can execute programs
👉 This is one of the most important concepts in cybersecurity 🔥
🧠 Permission Types
Each file/folder has 3 permissions:
Symbol - Meaning
r - Read
w - Write
x - Execute
👥 Permission Groups
Permissions are assigned to:
Group - Meaning
User (u) - File owner
Group (g) - Group members
Others (o) - Everyone else
📄 Example Permission
-rwxr-xr–
Breakdown 👇
Part - Meaning
rwx - User can read/write/execute
r-x - Group can read/execute
r– - Others can only read
🔥 chmod Command
👉 Used to change permissions
✅ Give Execute Permission
chmod +x script.sh
Now the script can run
✅ Remove Write Permission
chmod -w file.txt
🔢 Numeric Permission System
Number - Permission
7 - rwx
6 - rw-
5 - r-x
4 - r–
Example
chmod 755 script.sh
Meaning:
User - Group - Others
rwx - r-x - r-x
🎯 Real-Life Example
Suppose a hacker gains access to a server.
If permissions are weak:
❌ Sensitive files may become accessible
Good permissions help:
✅ Protect important data
🛡️ Cybersecurity Angle
Improper permissions can lead to:
- Unauthorized access
- Privilege escalation
- Data leaks
👉 Many real-world breaches happen because of bad permissions
📝 Quick Task
Create a file and try changing permissions 👇
touch demo.sh
chmod 755 demo.sh
ls -l
Observe how permissions change
🔥 Pro Tip
Always follow the principle of:
👉 Least Privilege
Meaning:
Give only the permissions actually needed