The Free Encyclopedia

File Permissions Explained

Linux permissions decide who can do what to every file. Once the rwx model clicks, the cryptic -rwxr-xr-- makes perfect sense.

Reading the bits

-rwxr-xr--   owner=rwx  group=r-x  other=r--
 │└┬┘└┬┘└┬┘
 │ │  │  └ other (everyone else)
 │ │  └ group
 │ └ owner (user)
 └ type (- file, d dir, l link)

Each of the three classes gets read, write, execute.

Changing them

chmod 640 file        # owner rw, group r, other none
chmod +x script.sh    # make executable
chown user:group file # change ownership

Numeric: r=4, w=2, x=1, summed per class. 640 = rw- r-- ---.

On directories, x means "enter"

On a file On a directory
r = read contents r = list names
w = modify w = add/remove files
x = run it x = cd into / access

A directory without x can't be entered even if readable — a common "permission denied" head-scratcher.

Security: keep secrets 600/640 and owned tightly — exactly how the wiki's config is locked down.

Related: Secrets Management · Linux Server Hardening Baseline · Understanding systemd

Categories: Linux and Sysadmin