Linux File Permissions Guide

Sat, May 31, 2025 - 1 min read

Linux file permissions are the foundation of system security. Every file and directory has an owner, a group, and a set of permissions that control who can read, write, or execute it.

Permission Types

Each file has three permission classes:

  • Owner (u) — the user who owns the file
  • Group (g) — the group assigned to the file
  • Others (o) — everyone else

And three permission types:

PermissionSymbolNumeric
Readr4
Writew2
Executex1

Using chmod

Change permissions with chmod using numeric or symbolic mode:

# Numeric mode — 755 = rwxr-xr-x
chmod 755 script.sh
 
# Symbolic mode
chmod u+x script.sh    # add execute for owner
chmod go-w script.sh   # remove write for group and others

Using chown

Change ownership with chown:

chown user:group file.txt
chown -R user:group /path/to/dir   # recursive

Umask

The umask command sets default permissions for new files:

umask 022   # files get 644, directories get 755

Understanding permissions is essential for securing your Linux system and troubleshooting access issues.