Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I was following this guide (http://xmodulo.com/2013/12/set-password-policy-linux.html) for setting up pam and password for policy for CentOS. Everything works great except the root or any user's password set by root doesn't have to follow that policy.

# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        sufficient    pam_fprintd.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        required      pam_deny.so

account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3 minlen=10 difok=4
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=5
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so

[root@dev ~]# passwd test
Changing password for user test
New password:
BAD PASSWORD: it is too short BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

share|improve this question
Per your tutorial, "Note that the password rules presented in this tutorial will be enforced only when non-root users change passwords, but not the root." Disable direct root login entirely and make privileged users sudo in. –  ceejayoz Jan 15 at 17:58

Your Answer


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

Browse other questions tagged or ask your own question.