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 viasyslog(3). ๐auditโ a little more extreme thandebug. yes, more. ๐quietโ turns off informational messages, namely the ones about session open and close, viasyslog(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. Thenullokargument overrides that default. ๐ซnullresetokโ lets users authenticate with a blank password if password reset is enforced, even ifnullokis not set. But heads up: if password reset is not required andnullokis 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 thepam_passwdqcmodule 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. TheMD5password hash algorithm is used for storing those old passwords. Instead of this option, thepam_pwhistorymodule 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 theMD5algorithm. ๐sha256โ when a user changes their password next, encrypt it with theSHA256algorithm. TheSHA256algorithm must be supported by thecrypt(3)function. โsha512โ when a user changes their password next, encrypt it with theSHA512algorithm. TheSHA512algorithm must be supported by thecrypt(3)function. โblowfishโ when a user changes their password next, encrypt it with theblowfishalgorithm. Theblowfishalgorithm must be supported by thecrypt(3)function. ๐กgost_yescryptโ when a user changes their password next, encrypt it with thegost-yescryptalgorithm. Thegost-yescryptalgorithm must be supported by thecrypt(3)function. ๐yescryptโ when a user changes their password next, encrypt it with theyescryptalgorithm. Theyescryptalgorithm must be supported by thecrypt(3)function. ๐- *
rounds=n* โ set the optional number of rounds of theSHA256,SHA512,blowfish,gost-yescrypt, andyescryptpassword 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 wherepam_unixwas not used for the authentication, or it returned authentication failure โ meaning some other authentication source or method succeeded. Classic example: public key authentication insshd. The module will returnPAM_SUCCESSinstead of the eventualPAM_NEW_AUTHTOK_REQDorPAM_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
- arch rolling: pam 1.7.3-1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms