To set password quality requirements on a CentOS or Red Hat Linux system, you can edit the /etc/pam.d/system-auth
file and add the pam_pwquality.so
module to the file.
For example, to set the minimum password length to 8 characters and require at least one upper case letter, one lower case letter, and one number, you can add the following line to the /etc/pam.d/system-auth
file:
password required pam_pwquality.so minlen=8 dcredit=-1 ucredit=-1 lcredit=-1 ocredit=-1
This will require that new passwords meet the specified quality requirements.
You can also use the pwquality.conf
file to specify additional password quality requirements. For example, to disallow passwords that contain the user's login name or parts of the user's full name, you can add the following lines to the pwquality.conf
file:
reject_username reject_first_name reject_middle_name reject_last_name
It's always a good idea to carefully review the documentation and use the appropriate options to set password quality requirements on your system. This will help ensure that users choose strong and secure passwords.