Pcornel
Linux · Security

PAM

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

Back to the Topic

Answer

PAM (Pluggable Authentication Modules) is the stack of modules (/etc/pam.d/<service>) that services such as login, sshd and sudo use for authentication, account checks, sessions and password changes.

Remember

Module order and control flags (required, requisite, sufficient) decide the result. On RHEL edit via authselect, on Debian via pam-auth-update — not by hand. Always keep a root session open when changing PAM.

First checks

  • faillock --user <user> — failed-login lockout state
  • sestatus / aa-status — SELinux or AppArmor state
  • ss -tulpn — listening services
  • journalctl -u sshd -g 'Failed' — failed logins
  • ausearch -m avc,user_login -ts today — audit events (auditd)

Verify in this order

service calls PAM → auth modules → account checks → session setup → result

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

Confirmation

Confirm action

Continue?