Linux File Permissions

Linux distinguishes three permission groups: owner (u), group (g) and others (o). Each has read (r=4), write (w=2) and execute (x=1).

View and Set

ls -l file.txt
# -rw-r--r-- 1 michael www-data 1024 Aug 25 12:00 file.txt

chmod 755 script.sh     # u=rwx, g=rx, o=rx
chown michael:www-data file.txt

Octal Notation

Each digit sums the rights: 7=rwx, 6=rw, 5=rx, 4=r. Typical: 755 for directories, 600 for private files. umask 022 creates files with 644.

ACLs

With setfacl -m u:user:rwx /path you grant fine-grained rights per user.

Related: Linux Basics · systemd Explained