What is it?
Linux uses a permission system with three levels (user, group, other) and three permissions (read=4, write=2, execute=1).
Why does it matter?
Permission errors are among the most common Linux problems. Understanding chmod lets you fix them confidently.
Learn file permissions — read/write/execute, chmod, chown, and groups.
Real-World Use Cases
- 💡 Real-world use - Practical application.
- ⚡ Performance - Critical skill.
- 🏢 Professional - Industry standard.
- 📚 Learning - Career essential.
Core Concept
Linux permissions control who can read, write, or execute files and directories.
Permission Types
-
r (read) → view file / list directory
-
w (write) → modify file / add-remove files in directory
-
x (execute) → run file / access directory
-rwxr-xr--
│ │ │ │ │ │
│ │ │ │ │ └── others
│ │ │ └──── group
│ └──────── owner
└────────── file type
chmod 755 file
chown user:group file
chgrp group file
setfacl -m u:user:rwx file
getfacl file
Quick Cheat Sheet
| Command | Purpose |
|---|---|
| chmod 755 file | set permissions |
| chown user:group file | change owner |
| chgrp group file | change group |
| setfacl -m u:user:rwx file | add ACL |
| getfacl file | view ACL |
Example
# create file
touch app.sh
# give execute permission
chmod 755 app.sh
# change owner
chown ubuntu:ubuntu app.sh
# give extra access to user
setfacl -m u:john:rw app.sh
Best Practice
- Use 644 for files, 755 for directories
- Avoid 777 (security risk)
- Use groups instead of giving access to everyone
- Prefer ACLs for multi-user environments
- Regularly audit permissions:
Q: What does chmod 755 mean?
Owner=rwx(7), group=r-x(5), others=r-x(5). Owner can read/write/execute; group and others can read and execute.
Comments (0)
No comments yet. Be the first!
Leave a Comment