Mastering Linux File Permissions and Ownership

In the world of Linux, where multi-user systems and server security are foundational principles, understanding file permissions and ownership is crucial. Whether you're a beginner exploring your first Linux distribution or a seasoned system administrator managing critical servers, knowing how permissions work is key to ensuring the integrity, privacy, and functionality of your system.
This guide will take you deep into the core of Linux file permissions and ownership—what they are, how they work, how to modify them, and why they matter.
Why File Permissions and Ownership Matter in Linux
Linux is built from the ground up as a multi-user operating system. This means:
-
Multiple users can operate on the same system simultaneously.
-
Different users have different levels of access and control.
Without a permissions system, there would be no way to protect files from unauthorized access, modification, or deletion. File permissions and ownership form the first layer of defense against accidental or malicious activity.
Linux Permission Basics: Read, Write, Execute
Each file and directory in Linux has three basic types of permissions:
-
Read (
r
) – Permission to view the contents of a file or list the contents of a directory. -
Write (
w
) – Permission to modify a file or create, rename, or delete files within a directory. -
Execute (
x
) – For files, allows execution as a program or script. For directories, allows entering the directory (cd
).
Permission Categories: User, Group, Others
Permissions are assigned to three distinct sets of users:
-
User (u) – The file's owner.
-
Group (g) – A group associated with the file.
-
Others (o) – Everyone else.
So for every file or directory, Linux evaluates nine permission bits, forming three sets of rwx
, like so:
rwxr-xr--
This breakdown means:
-
rwx
for the owner -
r-x
for the group -
r--
for others
Understanding the Permission String
When you list files with ls -l
, you’ll see something like this:
-rwxr-xr-- 1 alice developers 4096 Apr 4 14:00 script.sh
Let’s dissect it:
Source: Linux Journal - The Original Magazine of the Linux Community