Linux Permission Fundamentals
Understanding Linux Permissions Basics
Linux permissions are a critical security mechanism that controls access to files and directories. Every file and directory in a Linux system has three types of permissions associated with three different user categories.
graph TD
A[File Permissions] --> B[Read]
A --> C[Write]
A --> D[Execute]
B --> E[User]
B --> F[Group]
B --> G[Others]
Permission Categories and Types
Permission Type |
Symbol |
Numeric Value |
Description |
Read |
r |
4 |
View file contents |
Write |
w |
2 |
Modify file contents |
Execute |
x |
1 |
Run executable files |
Permission Ownership Structure
In Linux, each file has three permission sets:
- User (Owner) Permissions
- Group Permissions
- Others (Everyone) Permissions
Practical Permission Example
## Check file permissions
ls -l example.txt
-rw-r--r-- 1 user group 1024 Jan 1 12:00 example.txt
In this example, -rw-r--r--
represents:
- First
-
: File type (regular file)
rw-
: Owner can read and write
r--
: Group can read only
r--
: Others can read only
Permission Representation
Permissions can be represented in two ways:
- Symbolic mode (rwx)
- Numeric mode (octal values)
Numeric mode calculates permissions by summing values:
- Read = 4
- Write = 2
- Execute = 1
Example: chmod 644 file.txt
sets read-write for owner, read-only for others.