Pcornel
Linux · Users & Groups

root

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

Back to the Topic

Answer

root (UID 0) is the superuser: it bypasses permission checks and can change anything on the system.

Remember

Work as a normal user and use sudo for single commands; it logs who did what. Disable direct root SSH login (PermitRootLogin no or prohibit-password). Keep a way to reach root for recovery (console, rescue mode).

First checks

  • sshd -T | grep -i permitrootlogin — effective root login setting
  • id <user> — UID, primary group and groups
  • getent passwd <user> — account entry (local or directory)
  • getent group <group> — group members
  • sudo -l -U <user> — what the user may run with sudo

Commands

sudo <command>
sudo -i
sudo -s
ping
sudo

Verify in this order

admin user authenticates → sudo checks the sudoers rules → command runs as UID 0 → action logged

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=2700

Confirmation

Confirm action

Continue?