Skip to main content

Linux PAM

Status: Scaffold — content in progress

PAM (Pluggable Authentication Modules) is the Linux authentication framework. It sits between applications and authentication mechanisms, providing a modular, configurable auth layer.

PAM Stack

/etc/pam.d/sshd ← per-service PAM configuration
/etc/pam.d/common-auth ← shared auth stack

Each line in a PAM config: type control module arguments

TypePurpose
authVerify identity
accountAccess control (is account valid, not expired, locked?)
passwordPassword changing rules
sessionSession setup/teardown

Key Modules

ModuleFunction
pam_unixStandard Unix password auth (checks /etc/shadow)
pam_sssSSSD integration — AD/LDAP auth
pam_krb5Kerberos auth
pam_tally2 / pam_faillockLockout after failed attempts
pam_google_authenticatorTOTP second factor
pam_execExecute arbitrary command on auth — dangerous if misconfigured

Attack Surface

  • Writable /etc/pam.d/ → install backdoor module (e.g., pam_exec running reverse shell)
  • pam_unix with weak passwords
  • PAM debug logging can leak credentials to syslog
TopicLink
Linux SSSDlinux-sssd
Linux Kerberoslinux-kerberos