For Authentication, Account Management and Authorization, PAM is the core module and pam_unix provides mentioned functionality. Same module can be used to maintain a list of old passwords for every user. This is useful if you want to disallow use of old passwords. You can find out old password list from /etc/security/opasswd file.
Open /etc/pam.d/system-auth file of Fedora Core or Red Hat or Cent OS Linux system.
# vim /etc/pam.d/system-auth

Now, append following line:

password sufficient pam_unix.so use_authtok md5 shadow remember=5

Save and exit the file.

Now, Linux will remember last 5 passwords. If user tries to use any one of the last 5 old passwords, they will get an error:

Password has been already used. Choose another.

Related Articles: