If you’ve ever seen a “Permission denied” error in Linux, you’re not alone. Understanding Linux file permissions is one of the most fundamental skills every DevOps, SysAdmin, and cybersecurity learner must master.
In this post (Day 6 of our Linux Learning Series), you’ll finally understand chmod
, chown
, and Linux permissions — with clear examples, simple analogies, and real-world use cases.
Prefer to watch? Here’s the full video tutorial:
Linux permissions control who can read, write, or execute a file or folder.
Each file has three sets of permissions:
- 👤 Owner
- 👥 Group
- 🌐 Others
You’ll see something like this:
Let’s break that down:
r
= readw
= writex
= execute-
= no permission
🔧 What is chmod
?
chmod
stands for change mode. It’s used to change file permissions.
🔹 Syntax:
chmod [permissions] [filename]
🛠 Example: Give execute permission to a script
chmod +x deploy.sh
🧠 Numeric Mode Explained
Number | Permission |
---|---|
7 | read, write, execute (rwx) |
6 | read, write (rw-) |
5 | read, execute (r-x) |
4 | read only (r–) |
Example:
chmod 755 app.sh
This means:
- Owner:
rwx
- Group:
r-x
- Others:
r-x
What is chown
?
chown
means change owner. It lets you assign a new owner and group to a file or directory.
🔹 Syntax:
chown [owner]:[group] [filename]
🛠 Example: Transfer ownership to user ubuntu
chown root:ubuntu app.sh
🧪 Common Real-World Use Cases
✅ Give execute access to a shell script
✅ Fix permissions for web server (Apache/Nginx)
✅ Secure logs so only root can read them
✅ Hand off file ownership between users
🧠 Pro Tips for DevOps & Security Engineers
- Use
ls -l
to list permissions - Use
chmod -R
andchown -R
for recursive changes - Be very cautious with
chmod 777
– it makes files world-accessible
📘 Cheat Sheet
Command | Description |
---|---|
chmod +x | Add execute permission |
chmod 644 | Read/write for owner, read for others |
chown user | Change file owner |
chown user:group | Change owner and group |
📌 Conclusion
Understanding chown
and chmod
isn’t just about memorizing commands. It’s about knowing how Linux protects your system. Whether you’re scripting, deploying, or locking down your servers — file permissions matter.
📚 Stay tuned for Day 7, where we dive into process management and signals in Linux!
💬 Questions or Suggestions?
Drop a comment below or message me on LinkedIn. Let’s master Linux together!