Understanding Linux File Permissions and Ownership: A Complete Guide for Beginners to Experts
Understanding Linux File Ownership and Permissions: A Beginner’s Guide
In the previous article we explored the Linux filesystem hierarchy and got familiar with its structure.
Now, let’s unlock a powerful concept: who can access what in Linux.
Mastering ownership and permissions is key to becoming confident in Linux — it’s the foundation of security and system administration.
Why Permissions Matter?
In Linux, everything is a file — programs, devices, directories, even your keyboard input.
Permissions are how Linux controls who can read, write, or execute these files.
This ensures:
Users don’t accidentally break system files.
Sensitive data is protected.
Multiple users can safely share one machine.
Understanding Ownership
Every file and directory in Linux has two owners:
User (Owner): The user account that owns the file.
Group: A collection of users who share permissions.
Let’s see ownership in action:
ls -l

Understanding Permissions
Permissions are shown in three sets of three characters:
-rw-r--r--
Let’s break this down:
| Position | Who It Applies To | Meaning Here |
|---|---|---|
rw- | User/Owner | Can read, write |
r-- | Group | Can read only |
r-- | Others | Can read only |
Each permission has a letter:
r= readw= writex= execute (run as a program)
The first - means it’s a file (it would be d for directory).
Changing Permissions
Using chmod
chmod lets you modify permissions.
Grant execute permission to the user:
chmod u+x script.sh

In the previous example, we used the command on the notes.txt file. You can see that the file name changed color to green, indicating it is now executable. It's recommended to use this command when running your bash script that ends with .sh.
Add write permission for group:
chmod g-w notes.txt

You can see how the write permission is removed from the group in the second photo.
Numeric (Octal) Mode
Permissions can also be set with numbers:
r = 4,w = 2,x = 1Add them up for each set.
Example:
chmod 755 script.sh

Breakdown:
| User | Group | Others |
|---|---|---|
| 7 | 5 | 5 |
| rwx | r-x | r-x |
Changing Ownership
Use chown to change the owner:
sudo chown alice notes.txt
Change both user and group:
sudo chown alice:devs notes.txt
Quick Reference Table
| Symbolic | Numeric | Meaning |
|---|---|---|
r-- | 4 | Read |
-w- | 2 | Write |
--x | 1 | Execute |
rw- | 6 | Read + Write |
r-x | 5 | Read + Execute |
rwx | 7 | Read + Write + Execute |
Visualizing Permissions
[ File Type ] [ User ] [ Group ] [ Others ]
- rw- r-- r--
Understanding umask (Default Permissions)
So far, you’ve learned how to view and modify permissions, but did you know new files and directories don’t start with random permissions?
Linux uses a setting called umask (user file-creation mode mask) to determine default permissions.
🔹 How umask works:
New files start with
666(read and write for everyone) minus theumask.New directories start with
777(read, write, execute for everyone) minus theumask.
Example:
umask Value | File Permissions | Directory Permissions | Meaning |
|---|---|---|---|
| 0000 | 666 | 777 | Full access for everyone (not safe) |
| 0022 | 644 | 755 | Owner can write, others read only |
| 0077 | 600 | 700 | Owner only, very secure |
You can view an example of umask in the shell screenshot, which illustrates how default permissions are applied to new files and directories based on the umask value.

Trivia: Why Files Start at
666and Directories at777Linux starts with full permissions:
Files:
666→ everyone can read/writeDirectories:
777→ everyone can read/write/enterThen
umasksubtracts permissions:# With umask 022 Files: 666 - 022 = 644 (owner can write, others read-only) Dirs: 777 - 022 = 755 (owner can write, others can read & enter)You may wonder why:
Files don’t get
x(execute) by default because not all files are programs.Directories need
xto let you cd into them.
Practice Challenge
Create a new directory to experiment in.
Inside it, create a sample text file.
Check its permissions using
ls -l.Change the file permissions to allow only the owner to read and write.
Change the permissions again to make it readable and executable by everyone.
Use
ls -lafter each change to see the effect.Change the file’s ownership to your user and group.
Reflect on how permissions and ownership control access to files.
Tips to Remember
Always use
ls -lto check permissions before editing files.Use
sudocarefully; it bypasses normal permission checks.Scripts must be executable (
chmod +x) to run directly.
What’s Next in Your Linux Journey
The goal here is to get comfortable navigating your system and start recognizing patterns.
Don’t worry about understanding every permission combination just yet — we’ll revisit and build on this knowledge as you use Linux more.
You’ve now unlocked a key concept of Linux security by learning file permissions and ownership.
Up Next: Mastering Linux Package Management
Now that you understand permissions and ownership, you’re ready to take control of your system’s software.
In the next article, we’ll cover:
How Linux installs and updates software
Using
yum(CentOS) andapt(Ubuntu)Tips to manage packages like a pro
By the end of the next article, you’ll be able to customize and manage your Linux environment with confidence.
📢 Want to follow the full series?
Subscribe to my Hashnode and never miss a step in your Linux learning journey!