Linux permissions control who can access files and directories. They’re assigned to users
and groups
, with each user potentially belonging to multiple groups. Being in a group grants specific access rights to files and directories associated with that group.
Permission Values
Number Permission Meaning 0
---
No permission 1
--x
Execute only 2
-w-
Write only 3
-wx
Write and execute 4
r--
Read only 5
r-x
Read and execute 6
rw-
Read and write 7
rwx
Full access (read, write, execute)
Common Permission Combinations
Value Symbolic Description 755
rwxr-xr-x
Owner: full access; Group/Others: read & execute 644
rw-r--r--
Owner: read & write; Group/Others: read only 700
rwx------
Owner: full access; Group/Others: no access 777
rwxrwxrwx
Everyone has full access (use with caution
)
Setting Permissions
# Numeric method
chmod 755 file.txt # rwxr-xr-x
# Symbolic method
chmod u+x script.sh # Add execute for owner
chmod go-w file.txt # Remove write from group/others
chmod -R 755 directory/ # Apply recursively to directory
Checking Permissions
ls -l file.txt # List file permissions
ls -ld directory/ # List directory permissions