# How to modify the password quality requirements

/etc/pam.d/system-auth - Common configuration file for PAMified services

~]# cat /etc/pam.d/system-auth
#%PAM-1.0
auth        required      pam_env.so
auth        sufficient    pam_unix.so try_first_pass nullok
auth        required      pam_deny.so
account     required      pam_unix.so
password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password    sufficient    pam_unix.so try_first_pass use_authtok nullok yescrypt shadow
password    required      pam_deny.so
session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so

pam_pwquality.so - PAM module to perform password quality checking

These checks are configurable either by use of the module arguments or by modifying the /etc/security/pwquality.conf configuration file.

For example:

~]# vim /etc/pam.d/system-auth
password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= minlen=12 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1 enforce_for_root

minlen=12: The password contains a minimum of 12 characters.
lcredit=-1: The password should contain at least one of the lowercase letters.
ucredit=-1: The password should contain at least one uppercase letter.
dcredit=-1: The password should contain at least one digit.
ocredit=-1: The password should contain at least one other symbols, such as @, #,! $% etc.
enforce_for_root: Ensure that the complexity policy is enforced even if the root user sets the password.

Edited on