Under CentOS Linux it is possible to lock out a user login after failed login attempts. This is a security feature. You can also automatically unlock account after some time.
pam_tally – login counter (tallying) module
This module maintains a count of attempted accesses, can reset count on success, can deny access if too many attempts fail.
Use /etc/pam.d/system-auth configuration file to configure attempted login accesses and other related activities. Append following AUTH configuration to /etc/pam.d/system-auth file:
auth required pam_tally.so onerr=fail deny=5 unlock_time=21600
(a)deny=5 – Deny access if tally for this user exceeds 5 times.
(b) unlock_time=21600 – Allow access after 21600 seconds (6 hours) after failed attempt. If this option is used the user will be locked out for the specified amount of time after he exceeded his maximum allowed attempts. Otherwise the account is locked until the lock is removed by a manual intervention of the system administrator.
(c) onerr=fail – If something weird happens (like unable to open the file), return with PAM_SUCESS if onerr=succeed is given, else with the corresponding PAM error code.
Default file /var/log/faillog is used to keep login counts.
The above PAM module is part of all Linux distribution and configuration should work with any Linux distribution.
- man pages faillog, pam.conf, pam.d, pam, and pam_tally
- pam_tally – login counter (tallying) module documentation.
- CentOS Linux project