Linux for DevOps – Part 2: Files, Directories & Permissions Explained Simply
Introduction
In real DevOps work, many problems happen because of wrong file or directory permissions.
You may see errors like:
❌ Permission denied
❌ Script not executable
❌ Jenkins pipeline failed
These issues are not bugs, they are Linux permission problems.
In this blog, we will understand:
Linux files and directories
How permissions work
chmodandchownA real DevOps example
All explained in simple English.
Linux Files and Directories
Linux treats everything as a file.
Common File Types
Regular file (
-) → text files, scripts, logsDirectory (
d) → foldersSymbolic link (
l) → shortcut to another file
You can check file type using:
ls -l
Basic File and Directory Commands
These commands are used daily by DevOps engineers.
touch file.txt # Create a file
mkdir logs # Create a directory
rm file.txt # Delete a file
cp app.log backup.log # Copy a file
mv old.txt new.txt # Rename or move a file
Understanding Linux Permissions
Every file and directory has three levels of access:
Owner – user who owns the file
Group – group associated with the file
Others – everyone else
Permission Types
r→ readw→ writex→ execute
Example:
-rwxr-xr--
Meaning:
Owner → read, write, execute
Group → read, execute
Others → read only
chmod – Change File Permissions
The chmod command is used to change permissions.
Numeric Method
chmod 755 script.sh
Symbolic Method
chmod +x script.sh
👉 This is very common in DevOps when scripts fail to run.
chown – Change File Ownership
The chown command changes the owner and group of a file.
chown ubuntu:ubuntu file.txt
This means:
Owner = ubuntu
Group = ubuntu
Real DevOps Scenario (Very Important)
Problem:
A Jenkins pipeline fails with this error:
Permission denied
Reason:
Jenkins does not have permission to execute the script.
Solution:
chmod +x deploy.sh
chown jenkins:jenkins deploy.sh
✅ Pipeline works successfully.
This is a real production-level DevOps issue.
Best Practices for DevOps Engineers
❌ Do NOT use
chmod 777in production✅ Give minimum required permissions
✅ Use groups for access control
✅ Always check permissions before deployment
Conclusion
Linux permissions are one of the most important DevOps skills.
If you understand:
Files and directories
chmodandchown
You can solve most “Permission denied” errors easily.
In the next part, we will learn:
👉 Users, Groups, Processes & Services in Linux


