Zuerst muss das libpam-cracklib PAM Modul installiert werden, um die Cracklib Unterstützung zu aktivieren.
# apt-get install libpam-cracklib
Nun doe Konfigurationsdatei öffnen:
# vi /etc/pam.d/system-auth
Folgende Zeile abändern oder einfügen:
password required pam_cracklib.so retry=2 minlen=10 difok=6
Nun die Datei abspeichern und schließen.
Syntax
- retry=2 : Prompt user at most 2 times before returning with error
- minlen=10 : minimum length allowed for an account password is set to 10 characters. This is the minimum simplicity count for a good password. And you are allowed only 2 times using retry option.
- difok=6: How many characters can be the same in the new password relative to the old. User will see error - BAD PASSWORD: is too similar to the old one
- You can also apply following options to compute the 'unsimplicity' of the password.
- dcredit=N : Digits characters
- ucredit=N : Upper characters
- lcredit=N : Lower characters
- ocredit=N : Other characters
Please note that restrictions are only applied to normal users (not to root user).