PAM_PWHISTORY(8)

๐Ÿ’– PAM_PWHISTORY ๐Ÿ’–

okay bestie, welcome to pam_pwhistory โ€” it's a Linux-PAM manual page and it's literally the bouncer at the password club ๐ŸŽ€


โœจ NAME โœจ

pam_pwhistory โ€” the PAM module that remembers your last passwords (yes, all of them, it's keeping receipts ๐Ÿ’…)


โœจ SYNOPSIS โœจ

pam_pwhistory.so [debug] [use_authtok] [enforce_for_root] [remember=N]
                 [retry=N] [authtok_type=STRING] [file=/path/filename]
                 [conf=/path/to/config-file]

โœจ DESCRIPTION โœจ

So basically this module keeps the last passwords of each user on file so it can force a password change history and stop people from just vibing back and forth between the same two passwords forever. It's giving "you can't sit with us" but for your old password ๐ŸŒธ

Important: this module does not work together with kerberos. And honestly? Using it with NIS or LDAP doesn't make much sense either, because the old passwords live on the local machine and are not available on another machine for password history checking. So like, the lore only exists locally, no cap ๐Ÿซถ


โœจ OPTIONS โœจ

  • debug โ€” turns on debugging via syslog(3). Very "let me see what's happening in here" energy ๐Ÿ”
  • use_authtok โ€” when you're changing a password, this forces the module to use the new password that a previously stacked password module handed over. (This is exactly what's happening in the stacking example with pam_passwdqc down below, iykyk.)
  • enforce_for_root โ€” if you set this, the check gets enforced for root too. No exceptions, no nepo baby privilege ๐Ÿ‘‘
  • remember=N โ€” the last N passwords for each user get saved. Default is 10. And listen โ€” a value of 0 makes the module keep the existing contents of the opasswd file unchanged. Like, untouched, frozen, periodt.
  • retry=N โ€” prompt the user at most N times before it returns with an error. Default is 1. One shot, one opportunity ๐ŸŽฏ
  • authtok_type=STRING โ€” go read pam_get_authtok(3) for more details on this one bestie.
  • file=/path/filename โ€” store the password history in /path/filename instead of the default location. The default location is /etc/security/opasswd ๐Ÿ“
  • conf=/path/to/config-file โ€” use another configuration file instead of the default /etc/security/pwhistory.conf.

The options for configuring the module behavior are described in the pwhistory.conf(5) manual page. And here's the tea: the options specified on the module command line override the values from the configuration file. Command line wins, always ๐Ÿ’…


โœจ MODULE TYPES PROVIDED โœจ

Only the password module type is provided. That's it. That's the whole list. She's specialized ๐ŸŽ€


โœจ RETURN VALUES โœจ

  • PAM_AUTHTOK_ERR โ€” no new password was entered, the user aborted the password change, or the new password couldn't be set. It's giving "never mind, forget it" ๐Ÿ˜ญ
  • PAM_IGNORE โ€” password history was disabled. The module said "not my problem today" ๐Ÿ™ˆ
  • PAM_MAXTRIES โ€” password was rejected too often. Too many tries, bestie, the door is closed ๐Ÿ”ฅ
  • PAM_USER_UNKNOWN โ€” user is not known to system. Who? Never heard of her ๐Ÿ’€

โœจ EXAMPLES โœจ

An example password section would be:

#%PAM-1.0
password     required       pam_pwhistory.so
password     required       pam_unix.so        use_authtok

And in combination with pam_passwdqc:

#%PAM-1.0
password     required       pam_passwdqc.so    config=/etc/passwdqc.conf
password     required       pam_pwhistory.so   use_authtok
password     required       pam_unix.so        use_authtok

Look at that stacking. Iconic behavior, honestly ๐ŸŒˆ


โœจ FILES โœจ

  • /etc/security/opasswd โ€” default file with password history ๐Ÿ—‚๏ธ
  • /etc/security/pwhistory.conf โ€” config file for pam_pwhistory options โš™๏ธ

โœจ SEE ALSO โœจ

pwhistory.conf(5), pam.conf(5), pam.d(5), pam(8), pam_get_authtok(3)

Go read them, they're all part of the same friend group ๐Ÿฆ‹


โœจ AUTHOR โœจ

pam_pwhistory was written by Thorsten Kukuk <kukuk@thkukuk.de> โ€” king behavior, we stan ๐Ÿ‘‘


and that's the whole page bestie!! this was the Linux-PAM Manual's PAM_PWHISTORY(8), and the footer tea is: <b>Linux-PAM</b>, dated <b>09/27/2026</b> ๐Ÿ’– mwah, go change your password (to something new, obviously, the module is watching ๐Ÿ’…โœจ)

๐Ÿ“ฆ where this page comes from