Lesson 12 of 29 ↓
- 1.Rhel 9 Administration Guide
- 2.Ubuntu Boot Process Guide
- 3.Linux Basic Commands Guide
- 4.Comprehensive Unix Shells Guide
- 5.Mastering Vim Deep & Practical Guide
- 6.Magic Numbers in Linux Deep Systems Guide
- 7.Wildcards & Globbing in Linux Deep Cli Guide
- 8.Linux Users & Groups Deep Administration Guide
- 9.Journaling in Linux Filesystems Deep Systems Guide
- 10.Getopt & Getoptlong Deep System-level Option Parsing Guide
- 11.Su Command in Linux Complete Guide with Environment Variables
- 12.Linux File Permissions and Ownership Complete Practical Guide
- 13.Ubuntu Package Management Apt Complete Guide
- 14.Bash Scripting Basics
- 15.Linux File System Essentials
- 16.Process and Thread Management
- 17.Session 10 : Introduction to Networking & the Application Layer
- 18.Linux Networking Cli & Introduction to Yocto for Machine Routing
- 19.Comprehensive Guide to Ssh (secure Shell)
- 20.Logical Volume Management (lvm) Guide
- 21.C Build Process & Libraries Guide
- 22.Archiving and Compression in Linux
- 23.Linux Package Managers: a Detailed Guide
- 24.Misra-c Guidelines Detailed Cheat Sheet
- 25.Mqtt Server Setup (pc as Server)
- 26.Detailed Explanation of Tty and Pts in Linux
- 27.Vim Cheat Sheet
- 28.Difference Between apt and apt-get
- 29.Difference Between apt Upgrade and apt Full-upgrade
2 min read
Linux File Permissions and Ownership Complete Practical Guide
Introduction
Linux is a multi-user system, and file permissions are the backbone of its security model. Every file and directory is protected by ownership rules that determine who can read, write, or execute it.
This guide explains permissions from kernel perspective to admin practice.
File Permission Model
Linux permissions are based on three subjects and three actions.
Subjects
| Subject | Symbol | Description |
|---|---|---|
| Owner | u |
User who owns the file |
| Group | g |
Group owning the file |
| Others | o |
Everyone else |
Permissions
| Permission | Symbol | Meaning |
|---|---|---|
| Read | r (4) |
View contents |
| Write | w (2) |
Modify |
| Execute | x (1) |
Run / access |
Understanding ls -l
-rw-r--r-- 1 alice developers 4096 file.txt| Field | Meaning |
|---|---|
- |
File type |
rw- |
Owner |
r-- |
Group |
r-- |
Others |
alice |
Owner |
developers |
Group |
Permission Bits Explained
| Numeric | Binary | Meaning |
|---|---|---|
| 7 | 111 | rwx |
| 6 | 110 | rw- |
| 5 | 101 | r-x |
| 4 | 100 | r-- |
Example:
chmod 755 script.shChmod Change Permissions
Symbolic Mode
chmod u+x script.sh
chmod g-w file.txt
chmod o-r secret.txtNumeric Mode
chmod 640 file.txtChown Change Ownership
sudo chown alice file.txt
sudo chown alice:developers file.txt
sudo chown -R alice /projectsChgrp Change Group
sudo chgrp developers project.txt
sudo chgrp -R admins /srvDirectory Permissions (critical)
| Permission | Effect on Directory |
|---|---|
r |
List names |
w |
Create/delete files |
x |
Access directory |
✅ Without x, you cannot access files even if readable.
Setuid, Setgid, Sticky Bit
Setuid
chmod u+s programProgram runs as file owner (e.g. passwd).
Setgid
chmod g+s directoryNew files inherit group.
Sticky Bit
chmod +t /tmpPrevents deleting others’ files.
Umask
Controls default permissions.
umask
umask 022Permission Resolution Order
-
Owner
-
Group
-
Others
The kernel stops at the first match.
Common Permission Mistakes
-
Forgetting execute bit on directories
-
Overusing
777 -
Ignoring group strategy
Summary
-
Linux permissions are kernel enforced
-
Numeric and symbolic modes exist
-
Directories behave differently
-
Special bits enable enterprise sharing
Comments
Loading the discussion…