{
    "mode": "man",
    "parameter": "pam_pwhistory",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/pam_pwhistory/8/json",
    "generated": "2026-10-04T06:42:16Z",
    "synopsis": "pampwhistory.so [debug] [useauthtok] [enforceforroot] [remember=N] [retry=N]\n[authtoktype=STRING] [file=/path/filename] [conf=/path/to/config-file]",
    "sections": {
        "NAME": {
            "content": "pampwhistory - PAM module to remember last passwords\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pampwhistory.so [debug] [useauthtok] [enforceforroot] [remember=N] [retry=N]\n[authtoktype=STRING] [file=/path/filename] [conf=/path/to/config-file]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module saves the last passwords for each user in order to force password change history\nand keep the user from alternating between the same password too frequently.\n\nThis module does not work together with kerberos. In general, it does not make much sense to\nuse this module in conjunction with NIS or LDAP, since the old passwords are stored on the\nlocal machine and are not available on another machine for password history checking.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "debug\nTurns on debugging via syslog(3).\n\nuseauthtok\nWhen password changing enforce the module to use the new password provided by a\npreviously stacked password module (this is used in the example of the stacking of the\npampasswdqc module documented below).\n\nenforceforroot\nIf this option is set, the check is enforced for root, too.\n\nremember=N\nThe last N passwords for each user are saved. The default is 10. Value of 0 makes the\nmodule to keep the existing contents of the opasswd file unchanged.\n\nretry=N\nPrompt user at most N times before returning with error. The default is 1.\n\nauthtoktype=STRING\nSee pamgetauthtok(3) for more details.\n\nfile=/path/filename\nStore password history in file /path/filename rather than the default location. The\ndefault location is /etc/security/opasswd.\n\nconf=/path/to/config-file\nUse another configuration file instead of the default /etc/security/pwhistory.conf.\n\nThe options for configuring the module behavior are described in the pwhistory.conf(5) manual\npage. The options specified on the module command line override the values from the\nconfiguration file.\n",
            "subsections": []
        },
        "MODULE TYPES PROVIDED": {
            "content": "Only the password module type is provided.\n",
            "subsections": []
        },
        "RETURN VALUES": {
            "content": "PAMAUTHTOKERR\nNo new password was entered, the user aborted password change or new password couldn't be\nset.\n\nPAMIGNORE\nPassword history was disabled.\n\nPAMMAXTRIES\nPassword was rejected too often.\n\nPAMUSERUNKNOWN\nUser is not known to system.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "An example password section would be:\n\n#%PAM-1.0\npassword     required       pampwhistory.so\npassword     required       pamunix.so        useauthtok\n\n\nIn combination with pampasswdqc:\n\n#%PAM-1.0\npassword     required       pampasswdqc.so    config=/etc/passwdqc.conf\npassword     required       pampwhistory.so   useauthtok\npassword     required       pamunix.so        useauthtok\n\n\n",
            "subsections": []
        },
        "FILES": {
            "content": "/etc/security/opasswd\nDefault file with password history\n\n/etc/security/pwhistory.conf\nConfig file for pampwhistory options\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "pwhistory.conf(5), pam.conf(5), pam.d(5), pam(7) pamgetauthtok(3)\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "pampwhistory was written by Thorsten Kukuk <kukuk@thkukuk.de>\n\nLinux-PAM                                    05/07/2023                             PAMPWHISTORY(8)",
            "subsections": []
        }
    },
    "summary": "pampwhistory - PAM module to remember last passwords",
    "flags": [],
    "examples": [
        "An example password section would be:",
        "#%PAM-1.0",
        "password     required       pampwhistory.so",
        "password     required       pamunix.so        useauthtok",
        "In combination with pampasswdqc:",
        "#%PAM-1.0",
        "password     required       pampasswdqc.so    config=/etc/passwdqc.conf",
        "password     required       pampwhistory.so   useauthtok",
        "password     required       pamunix.so        useauthtok"
    ],
    "see_also": [
        {
            "name": "pwhistory.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pwhistory.conf/5/json"
        },
        {
            "name": "pam.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pam.conf/5/json"
        },
        {
            "name": "pam.d",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pam.d/5/json"
        },
        {
            "name": "pam",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/pam/7/json"
        },
        {
            "name": "pamgetauthtok",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/pamgetauthtok/3/json"
        }
    ]
}