After adding the below configurations in /etc/pam.d/system-auth. The user account is not getting locked after multiple failed attempts. As per the below configuration the account should be locked after 3 failed attempts and the account should be locked for 1200 seconds as specified by unlock_time. Also, after adding the below configuration the failedlog started writing for the users failed attempts. Kindly let me know if there is any mistake in the below configuration so that I can lock the user account after 3 failed attempts. The OS I am using CentOS5.3.
auth required pam_tally2.so deny=3 unlock_time=1200 magic_root
account required pam_tally2.so
Full file content:
auth required pam_env.so
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth required pam_deny.so
auth required pam_tally.so magic_root
account required pam_tally.so deny=3 magic_root lock_time=180
account required pam_unix.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so
password required pam_cracklib.so try_first_pass retry=3 minlen=14,dcredit=-1,ucredit=-1,ocredit=-1 lcredit=-1
password sufficient pam_unix.so md5 remember=12 use_authtok
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