Master Linux File Permissions: Users, Groups, and chmod/chown Explained
This guide explains Linux file permission concepts—including owner, group, and others—covers read, write, and execute rights, demonstrates how to view permissions with ls -l, and provides detailed usage of chmod and chown commands with symbolic and numeric modes.
1 Linux File Permission Management Overview
1.1 Identity
In Linux, three identities can access a file or directory: owner (user), group (users belonging to the same group), and others (all remaining users).
1.2 Permission Types
Three permission categories exist: read (r) – commands like ls, cat; write (w) – commands like cp, mv, rm; execute (x) – commands like cd.
1.3 Root User
The root (superuser) has unrestricted privileges and can manage all other users.
2 Viewing Permissions
2.1 Using ls -l
ls -l
# Example output showing permission bits, owner, group, size, date, nameThe first character indicates the file type (d for directory, - for regular file, l for symlink, etc.). Characters 2‑4 represent owner permissions, 5‑7 group permissions, and 8‑10 others permissions. rwx denote read, write, execute; a dash (-) means the permission is absent.
3 Modifying Permissions
3.1 chmod Command
3.1.1 Syntax
chmod [option] filename/dirname
# The executor must be the owner or root3.1.2 Who to Set
u – owner (user)
g – group
o – others
a – all (u,g,o)
# If omitted, defaults to all3.1.3 Symbolic Mode
r – read
w – write
x – execute
- – no permission
+ – add permission
- – remove permission
= – set exact permission3.1.4 Numeric Mode
r = 4
w = 2
x = 1
0 = no permission
# Example: 754 means owner 7 (rwx), group 5 (r-x), others 4 (r--)3.1.5 Recursive Option -R
chmod -R 777 dir1 # Apply permissions recursively to directory and its contents4 Changing Owner and Group
4.1 chown Command
Changes the owner and/or group of a file or directory.
4.1.1 Syntax
chown [-R] newuser dirname
# For files, -R is not needed; for directories, use -R for recursion
# Executor must be root chown user:group filename # Set both owner and group
chown user filename # Set only owner
chown :group filename # Set only groupSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
