Beginner LevelLinux Commands & SysAdmin
How do Linux File Permissions (chmod, chown, chgrp) work in Octal and Symbolic notation?
❓ Interview Prompt: Explain read (4), write (2), execute (1) permissions across User, Group, and Others scope in Linux.
Linux file permissions manage read (r=4), write (w=2), and execute (x=1) rights across three permission scopes:
1
User (u): File owner.
2
Group (g): Users in the assigned group.
3
Others (o): All other system users.
Octal Notation:
Sums permission values per scope (e.g. 'chmod 755 script.sh' assigns rwx=7 to owner, r-x=5 to group, and r-x=5 to others). 'chown user:group file' updates ownership.
Code Implementation Example
bash
# Grant owner rwx (7), group r-x (5), others r-x (5)
chmod 755 deploy.sh
# Restrict file access to owner only (rw------- = 600)
chmod 600 id_rsa
# Recursively change ownership to deploy user and www-data group
sudo chown -R deploy:www-data /var/www/app💡Linux chmod octal permission and chown ownership commands.
🎯 Interview Key Takeaway
Always assign minimum necessary file permissions (e.g. 600 for SSH keys, 755 for executable scripts).
#Linux#Permissions#chmod#chown#Beginner
Back to all Linux Commands & SysAdmin Questions→