Pcornel
Linux · Permissions & Ownership

Numeric Permissions

Cheat sheet · https://pcornel.dk/topic.php?topic=2706

Back to the Topic

Answer

Numeric (octal) permissions write the mode as digits: r=4, w=2, x=1, summed per class — 644 is rw-r--r--, 755 rwxr-xr-x, 600 rw-------. A fourth leading digit sets SUID (4), SGID (2) and sticky (1).

Remember

Common values: 644 files, 755 directories and programs, 600 private keys, 700 private directories. umask (often 022) removes bits from new files. chmod -R 755 on a tree also makes files executable — use find -type d/-type f separately.

First checks

  • umask — default mask for new files
  • ls -l <path> — owner, group and mode
  • stat -c '%A %a %U:%G' <path> — symbolic and numeric mode with owner
  • namei -l <path> — permissions of every directory on the path
  • id <user> — user's groups

Verify in this order

digits per class → bits set with chmod → umask applied to new files → kernel checks bits on access

Where it usually breaks

First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2706

Confirmation

Confirm action

Continue?