Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Red Hat Linux or CentOS, how can one enforce that passwords consist of a mixture of alphabetical and numerical or special characters?

share|improve this question
up vote 6 down vote accepted

From the NSA securing RedHat Linux Guide: Set Password Quality Requirements

The default pam cracklib PAM module provides strength checking for passwords. It performs a number of checks, such as making sure passwords are not similar to dictionary words, are of at least a certain length, are not the previous password reversed, and are not simply a change of case from the previous password. The pam passwdqc PAM module provides the ability to enforce even more stringent password strength requirements. It is provided in an RPM of the same name. The man pages pam cracklib(8) and pam passwdqc(8) provide information on the capabilities and configuration of each. If password strength stronger than that guaranteed by pam cracklib is required, configure PAM to use pam passwdqc.

To activate pam passwdqc, locate the following line in /etc/pam.d/system-auth:

 password  requisite try_first_pass retry=3

and then replace it with the line:

 password  requisite min=disabled,disabled,16,12,8

If necessary, modify the arguments (min=disabled,disabled,16,12,8) to ensure compliance with your organization’s security policy. Configuration options are described in the man page pam passwdqc(8) and also in /usr/share/doc/pam passwdqc-version. The minimum lengths provided here supercede that specified by the argument PASS MIN LEN as described in Section The options given in the example above set a minimum length for each of the password “classes” that pam passwdqc recognizes. Setting a particular minimum value to disabled will stop users from choosing a password that falls into that category alone.

The NSA Guide to Securing RedHat

Be careful when you make edits to files in /etc/pam.d!

share|improve this answer

you should find the needed information here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.