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

NumberPermissionMeaning
0---No permission
1--xExecute only
2-w-Write only
3-wxWrite and execute
4r--Read only
5r-xRead and execute
6rw-Read and write
7rwxFull access (read, write, execute)

Common Permission Combinations

ValueSymbolicDescription
755rwxr-xr-xOwner: full access; Group/Others: read & execute
644rw-r--r--Owner: read & write; Group/Others: read only
700rwx------Owner: full access; Group/Others: no access
777rwxrwxrwxEveryone 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