Linux file permissions control who can read, write, and execute files. Understanding chmod, chown, and umask is essential for secure server administration.
What you will learn
- Core commands for daily Linux administration
- Practical examples you can run on Ubuntu, Debian, or RHEL-based systems
- Common mistakes and troubleshooting tips
Check current permissions
Use ls -l to inspect permissions:
ls -l /etc/passwd
The first column shows permission bits such as -rw-r–r–.
Change permissions with chmod
Give the owner execute permission:
chmod u+x script.sh
Use numeric mode for quick changes: chmod 755 script.sh
Change ownership with chown
Assign a file to another user and group:
sudo chown www-data:www-data index.html
Ownership matters for web servers and shared apps.
Understand umask
Check the default permission mask:
umask
umask subtracts permissions from newly created files.
Best practices
- Never chmod 777 on production systems unless absolutely required
- Use groups for shared project directories
- Audit permissions regularly on sensitive paths like /etc and /var/www
Conclusion
Practice these commands on a test VM before using them on production servers. Bookmark this guide and explore related Linux tutorials on linux basics topics next.
