PAM_UNIX(8)

๐ŸŒธ NAME ๐ŸŒธ

okay bestie, gather round, because we're talking about pam_unix โ€” the module for traditional password authentication. it's the OG. the blueprint. the one your whole login flow is lowkey built on. ๐Ÿ’–


โœจ SYNOPSIS โœจ

pam_unix.so [...]

yes that's it. that's the whole vibe. ๐ŸŽ€


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

This is the standard Unix authentication module, periodt. It uses standard calls from the system's libraries to retrieve and set account information and to do authentication. Usually all that info comes from /etc/passwd and from /etc/shadow too, if shadow is enabled. no cap. ๐Ÿ‘‘

the account component does the job of figuring out the status of the user's account and password, based on these shadow elements: expire, last_change, max_change, min_change, warn_change. With that last one (warn_change), it might give the user advice about changing their password, or โ€” through the PAM_AUTHTOKEN_REQD return โ€” it can delay giving the user service until they've set up a new password. All those entries are documented over in shadow(5). And listen: if the user's record is missing one or more of those entries, then the corresponding shadow check just doesn't happen. we don't do checks we can't do. ๐Ÿ’…

the authentication component checks the user's credentials (i.e. the password, bestie). The default action of this module is to not let the user into a service if their official password is blank. blank password = no entry. it's giving locked door. ๐Ÿšช

There's a helper binary, unix_chkpwd(8), that checks the user's password when it's stored in a read-protected database. This binary is very simple and will only ever check the password of the user who invoked it. It gets called transparently on behalf of the user by the authenticating component of this module. The whole point? So apps like xlock(1) can work without being setuid-root. iconic behavior honestly. ๐Ÿซถ

By default, the module will temporarily turn off SIGCHLD handling for the whole duration of the helper binary's execution. This is generally the right thing to do, because so many applications are just not prepared to handle this signal from a child they didn't even know was fork()d. ๐Ÿ˜ญ If you need to suppress that temporary shielding, the noreap module argument does it โ€” and you might need it for certain applications.

The maximum length of a password that pam_unix supports via the helper binary is PAM_MAX_RESP_SIZE โ€” currently 512 bytes. Anything past that in the password the conversation function hands to the module just gets ignored. bye. ๐Ÿ’€

the password component handles updating the user's password. The default encryption hash is taken from the ENCRYPT_METHOD variable in login.defs. If that variable is absent and no hash algorithm option was passed to the module, then SHA512 is used as the built-in default. the fallback ate. ๐Ÿ”ฅ

the session component just logs when a user logs in or leaves the system. simple. observant. main character energy. โญ

Any remaining arguments that are supported by other functions of this module are silently ignored. Any other arguments get logged as errors through syslog(3). we see you, typo. ๐Ÿ™ˆ


๐Ÿ’… OPTIONS ๐Ÿ’…

  • debug โ€” turns on debugging via syslog(3). ๐Ÿ”
  • audit โ€” a little more extreme than debug. yes, more. ๐ŸŒˆ
  • quiet โ€” turns off informational messages, namely the ones about session open and close, via syslog(3). shhh. ๐Ÿคซ
  • nullok โ€” the default action of this module is to not permit the user access to a service if their official password is blank. The nullok argument overrides that default. ๐Ÿ’ซ
  • nullresetok โ€” lets users authenticate with a blank password if password reset is enforced, even if nullok is not set. But heads up: if password reset is not required and nullok is not set, then authentication with a blank password will be denied. rules are rules. ๐ŸŽ€
  • try_first_pass โ€” before prompting the user for their password, the module first tries the previous stacked module's password, in case that satisfies this module too. ๐Ÿฆ‹
  • use_first_pass โ€” forces the module to use a previous stacked module's password and will never prompt the user. If no password is available, or the password isn't appropriate, the user gets denied access. no takebacks. ๐Ÿ˜ค
  • nodelay โ€” use this to discourage the authentication component from requesting a delay when the authentication as a whole fails. The default action is for the module to request a delay-on-failure of the order of two seconds. โณ
  • use_authtok โ€” when changing passwords, this forces the module to set the new password to the one provided by a previously stacked password module (this is what's used in the stacking example with the pam_passwdqc module documented below). โœจ
  • *authtok_type=type* โ€” modifies the password prompt when changing passwords, so it includes the type of the password. Empty by default. ๐Ÿ’œ
  • nis โ€” NIS RPC is used for setting new passwords. ๐ŸŒ
  • *remember=n* โ€” the last n passwords for each user get saved in /etc/security/opasswd, to force password change history and keep the user from flipping back and forth between the same password too often. The MD5 password hash algorithm is used for storing those old passwords. Instead of this option, the pam_pwhistory module should be used. (yeah, they said it, not me. ๐Ÿ˜ญ)
  • shadow โ€” try to maintain a shadow-based system. ๐Ÿ‘ป
  • md5 โ€” when a user changes their password next, encrypt it with the MD5 algorithm. ๐Ÿ”
  • sha256 โ€” when a user changes their password next, encrypt it with the SHA256 algorithm. The SHA256 algorithm must be supported by the crypt(3) function. โœ…
  • sha512 โ€” when a user changes their password next, encrypt it with the SHA512 algorithm. The SHA512 algorithm must be supported by the crypt(3) function. โœ…
  • blowfish โ€” when a user changes their password next, encrypt it with the blowfish algorithm. The blowfish algorithm must be supported by the crypt(3) function. ๐Ÿก
  • gost_yescrypt โ€” when a user changes their password next, encrypt it with the gost-yescrypt algorithm. The gost-yescrypt algorithm must be supported by the crypt(3) function. ๐ŸŒŸ
  • yescrypt โ€” when a user changes their password next, encrypt it with the yescrypt algorithm. The yescrypt algorithm must be supported by the crypt(3) function. ๐ŸŒŸ
  • *rounds=n* โ€” set the optional number of rounds of the SHA256, SHA512, blowfish, gost-yescrypt, and yescrypt password hashing algorithms to n. ๐Ÿ”„
  • broken_shadow โ€” ignore errors reading shadow information for users in the account management module. ๐Ÿ™ˆ
  • *minlen=n* โ€” set a minimum password length of n characters. ๐Ÿ“
  • no_pass_expiry โ€” when set, ignore password expiration as defined by the user's shadow entry. This option only has an effect in the case where pam_unix was not used for the authentication, or it returned authentication failure โ€” meaning some other authentication source or method succeeded. Classic example: public key authentication in sshd. The module will return PAM_SUCCESS instead of the eventual PAM_NEW_AUTHTOK_REQD or PAM_AUTHTOK_EXPIRED. ๐Ÿ•ฐ๏ธ
Invalid arguments are logged with syslog(3). so like, spell it right bestie. ๐Ÿ’€

๐ŸŽ€ MODULE TYPES PROVIDED ๐ŸŽ€

All module types are provided: account, auth, password and session. all of them. the full set. she does it all. ๐Ÿ‘‘


๐Ÿ’– RETURN VALUES ๐Ÿ’–

  • PAM_IGNORE โ€” ignore this module. that's the whole note. she said "not my business." ๐Ÿ’…

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

An example usage for /etc/pam.d/login would be:

# Authenticate the user
auth       required   pam_unix.so
# Ensure user's account and password are still active
account    required   pam_unix.so
# Change the user's password, but at first check the strength
# with pam_passwdqc(8)
password   required   pam_passwdqc.so config=/etc/passwdqc.conf
password   required   pam_unix.so use_authtok nullok yescrypt
session    required   pam_unix.so

look at that stacking. the use_authtok nullok yescrypt combo? chef's kiss. ๐Ÿ‘ฉโ€๐Ÿณ๐Ÿ’‹


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€


๐Ÿซถ AUTHOR ๐Ÿซถ

pam_unix was written by various people. (a whole committee of legends, fr fr. ๐Ÿ’œ)


and that's the whole page bestie!! this came out of the Linux-PAM Manual, dated 09/27/2026, and it's the PAM_UNIX(8) page itself. drink some water, log out of root, and go to sleep. mwah. ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ where this page comes from