Systems study
Offline — showing the cached copy.
Home / Linux / 3. Permissions, users and privilege

3. Permissions, users and privilege

One-liner. Unix permissions are a coarse allow-list; capabilities and ACLs are the precision tools.

Memorize

  • Mode bits: owner / group / other × rwx; execute on a directory means traverse, read means list.
  • umask masks new-file permissions (default 022 → 644 files, 755 dirs).
  • setuid/setgid run with the file owner's/group's identity — a common privilege-escalation source.
  • sticky bit on /tmp lets only the owner delete their files.
  • ACLs (getfacl/setfacl) grant per-user/per-group rights; capabilities (cap_net_bind_service) split root into pieces.
  • sudo checks /etc/sudoers (use visudo); sudo -l shows what you may run.
  • Never run services as root by default: User=, NoNewPrivileges=, ProtectSystem=strict.
PRIVILEGE LOGIN PAM password/key session IDENTITY uid/gid + suppl… ESCALATION sudo (policy) o… KERNEL CHECK capabilities + …
Privilege

Trap. chmod 777 to "fix" access — it grants write to everyone and often disables security controls. Do this. Fix ownership/group and use 750/640; add an ACL for the one extra user.

Check

A directory has mode 750 and is owned by app:deploy. A user in group deploy can do what?