Unlock Linux File Permissions: A Complete Guide to Managing Access Rights
This article explains Linux file permission concepts, numeric and symbolic representations, how to combine and modify permissions with chmod (including recursive changes), ownership categories, testing permission effects on files and directories, and default permission settings derived from umask.
Linux Permission Management
Permissions define what actions a user can perform on a file; the root user has all permissions.
1. Permission Classification
Permissions are divided into three parts, each with a numeric code:
Read (r) : 4
Write (w) : 2
Execute (x) : 1
No permission (-) : 0
Executing a script == running a script2. Detailed Permission Information
Permission bits are split into three sections: owner, group, others.
Example: drwxr-xr-x
d : file type
rwx : owner
r-x : group
r-x : others3. Adding Permissions by Summation
Using drwxr-xr-x as an example:
Owner : read, write, execute
Group : read, execute
Others: read, execute
rwxr-xr-x is equivalent to 7554. Modifying Permissions
Command: chmod
Format: chmod [options] permission_expression target
Options:
-R : apply changes recursively to directories and their contents
Example: chmod -R 755 /root/text/ # sets all files to rwxr-xr-x5. Ownership Categories
Owner : u
Group : g
Others: o
Purpose: change permissions for a specific class.
Example: chmod g-r,g+w 1.txt # remove read from group, add write6. Why Testing Permissions Matters for Users
Regular users must strictly follow permission rules.
Root user overrides permission restrictions.
Changes take effect after re‑login (su or su -).
7. Significance of Permissions on Directories
To read a file, the path must have execute (x) permission on each directory and read (r) on the file.
To write a file, the path needs execute on directories and write (w) on the file.
To execute a file, directories need read and execute, and the file itself needs execute.
8. Default Permissions for New Files
Check default file permissions with: /etc/profile
Common defaults:
Files : 666 (modified by umask)
Directories : 777 (modified by umask)
Default file permission = 644 (666 - 022)
Default directory permission = 755 (777 - 022)
Useful commands:
/usr/bin/id -un # username
/usr/bin/id -gn # group nameSigned-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.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
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.
