How to configure password complexity for all users including root using

Solution Verified - Updated -


  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6


  • How to configure password complexity for all users including root using passwdqc
  • Is it possible to configure/apply password complexity for all users including root using pam_cracklib module?
  • Which module should I use to configure password complexity for root user ?
  • Configure password complexity for root and other users using pam_passwdqc
  • PAM restrictions in password definition are not being forced (getting applied) to root account
  • Use PAM module to meet specific password strength criteria
  • Enforce password policies for root user using passwdqc.


  • By default, Red Hat Enterprise Linux uses the cracklib module to check password strength. However, the cracklib module doesn't enforce password strength checking on the "root". To enforce password checking for all accounts including the root user, another PAM module called passwdqc can be used instead of cracklib module.

  • Module is provided by pam_passwdqc package in Red Hat Enterprise Linux:

# rpm -qf /lib64/security/
  • Modify the /etc/pam.d/system-auth file as follows:
    Change the following line from:
password    requisite try_first_pass retry=3


password    requisite min=disabled,12,8,6,5 max=40 passphrase=3 match=4 similar=deny random=42 enforce=everyone retry=3
  • The passwdqc module uses different password checking options to the cracklib module. For detailed information on how to modify the behaviour of the passwdqc module, please refer to the man page of pam_passwdqc:
# man pam_passwdqc
  • Note that the passwdqc and cracklib modules perform similar functions, and should not be used in the same PAM configuration file. It also cannot enforce password strength checking during the installation process of Red Hat Enterprise Linux.

  • If configuring on a Red Hat Enterprise Linux 6 or above, /etc/pam.d/password-auth file need to be modified as well.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.