🔐 Linux File Permissions Explained – chmod, chown, and More
Introduction
Linux File Permissions: In Linux, file security is managed through permissions. Every file and directory has access rules that define who can read, write, or execute them.
In this guide, we’ll cover:
✅ How to check file permissions
✅ Understanding permission types
✅ Using chmod
, chown
, and chgrp
to control access
By the end, you’ll have a solid grasp of Linux file security.

📌 Understanding Linux File Permissions
In Linux, every file and directory has three types of permissions:
Permission | Symbol | Meaning | Example |
---|---|---|---|
Read | r | View file contents | Read a text file |
Write | w | Modify file contents | Edit a file |
Execute | x | Run as a program/script | Execute a shell script |
Permissions apply to three user groups:
Group | Symbol | Meaning |
---|---|---|
Owner | u | The file’s creator |
Group | g | Users within the assigned group |
Others | o | All other users |
🔍 Checking File Permissions
To check file permissions, use:
ls -l
Example output:
-rw-r--r-- 1 user user 1024 Feb 5 10:30 file.txt
Here’s what it means:
rw-
→ Owner (read & write)r--
→ Group (read-only)r--
→ Others (read-only)
📌 Changing File Permissions with chmod
The chmod
command modifies permissions using symbolic (+r
, -w
, etc.) or numeric (755
, 644
) notation.
1️⃣ Using Symbolic Mode
✅ Add execute permission for the owner:
chmod u+x script.sh
✅ Remove write permission for others:
chmod o-w file.txt
✅ Grant full access to the group:
chmod g+rwx folder/
2️⃣ Using Numeric Mode (Octal Values)
Permissions are represented as numbers:
Permission | Binary | Octal |
---|---|---|
r-- | 100 | 4 |
rw- | 110 | 6 |
rwx | 111 | 7 |
Example:
✅ Set file permissions to 755
(owner full access, others read & execute):
chmod 755 script.sh
✅ Set file permissions to 644
(owner read/write, others read-only):
chmod 644 document.txt

📌 Changing File Ownership with chown
The chown
command changes file ownership.
✅ Change owner of a file:
chown newuser file.txt
✅ Change owner and group:
chown newuser:newgroup file.txt
✅ Apply changes to all files in a directory:
chown -R newuser:newgroup /path/to/directory/
📌 Changing Group Ownership with chgrp
The chgrp
command changes group ownership.
✅ Assign a file to a new group:
chgrp developers project.doc
✅ Apply group changes recursively:
chgrp -R team /shared_folder/
📝 Practical Examples of File Permissions
Scenario 1: Making a Script Executable
If you create a shell script (myscript.sh
), it won’t run unless it has execute permission.
Fix it using:
chmod +x myscript.sh
./myscript.sh # Now it runs!
Scenario 2: Restricting Access to a File
If you have a private document:
chmod 600 private.txt
🔒 Now only the owner can read/write it!
Scenario 3: Giving Group Write Access
To let team members edit a shared file:
chmod 664 report.doc
chown :developers report.doc
🎯 Final Thoughts
Mastering Linux file permissions is essential for system security and multi-user environments. Now you know how to use chmod
, chown
, and chgrp
to control access!
💡 Next Blog: Essential Linux Commands Every User Should Know
Learn More:
Common Challenges in Incident Management
Essential Technical Skills for Aspiring Incident Managers
Understanding the ITIL Framework for Incident Management
Key Roles and Responsibilities in Incident Management
📌 Call to Action (CTA)
💬 Did you find this tutorial helpful? Drop a comment below!
🔔 Follow TechNops.com for more Linux tutorials!