This is very useful if you want to disallow users to use same old passwords. The old password file is located at/etc/security/opasswd. This can be achieved by using PAM module.
Open ‘/etc/pam.d/system-auth‘ file under RHEL / CentOS / Fedora.
Open ‘/etc/pam.d/common-password‘ file under Ubuntu/Debian/Linux Mint.
Add the following line to ‘auth‘ section.
Add the following line to ‘password‘ section to disallow a user from re-using last 5 password of his or her.
Only last 5 passwords are remember by server. If you tried to use any of last 5 old passwords, you will get an error like.