📁 File Permissions in Linux (Owner, Group, Others)
In Linux/Unix, each file and directory has permissions assigned to three types of users:
👤 1. Owner (User)
- The person who created the file or has been assigned ownership.
- Can read/write/execute based on
chmod. - Ownership can be changed with:
chown username filename
👥 2. Group
- A group of users who may share access.
- If you're part of the file's group, you get the group-level permissions.
- Group can be changed with:
chgrp groupname filename
🌍 3. Others (World)
- Everyone else not the owner and not in the group.
- Public users on the system.
🔢 chmod Numeric Permissions
Each permission type (read, write, execute) is represented by a number:
| Permission | Value | Symbol |
|---|---|---|
| Read | 4 | r |
| Write | 2 | w |
| Execute | 1 | x |
Add them to get the total:
7 = rwx(read + write + execute)6 = rw-(read + write)5 = r-x(read + execute)4 = r--(read only)0 = ---(no access)
Example: chmod 754 file.txt
| User Type | Value | Meaning |
|---|---|---|
| Owner | 7 | rwx |
| Group | 5 | r-x |
| Others | 4 | r-- |
⚠️ Common chmod Values
| Command | Meaning |
|---|---|
chmod 777 |
Everyone can read/write/execute |
chmod 755 |
Owner: all, Group/Others: read + execute |
chmod 644 |
Owner: read + write, Group/Others: read only |
chmod 600 |
Only owner can read/write |
chmod 666 |
All can read/write, no execute |
🔒 Note: Be careful with
chmod 777– it gives full control to everyone, which can pose a security risk. Use it only when absolutely necessary.
Written by A.M. Rinas