Welcome to Server Circle. It's a friendly site and all levels of experience are welcome. Be aware that we use cookies for your login.
Server Circle - Ask questions about Servers and get answers from experts.
Beta (0.47 sec)
Locking out accounts after password failures

Is there a way of dropping a user (and banning their IP) after too many password failures at login time ?

Thanks.
Asked by:
poppy
1375 points
 Report Abuse
 Share Page - Category: Linux Servers - Tags: Locking out accounts after password failures
 Enter your response
Please use Pastie.org to paste lengthy code or to fix formatting issues with code
  • Responses in reverse (2)

Best Answer

You can disable account for bad users...

Then you can write simple rule and put under /etc/pam.d

The following example, disable account after 3 unsuccessful login

Put the following directive under /etc/pam.d/system-auth



time authconfig is run.

auth required pam_env.so

auth required pam_tally.so per_user deny=3

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_succeed_if.so uid < 500 quiet

account required pam_permit.so

password required pam_cracklib.so try_first_pass retry=3

password sufficient pam_unix.so md5 shadow nullok try_first_pass 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


Response by:
jalal
3623 points
Yes, you can script around this or look at PAM settings:

Lock account:

passwd -l userName

Unlock account:

passwd -u userName

Response by:
Bogofilter
1565 points


  • Related Questions
About Us : Contact Us : Etiquette : Terms : CDN Failover : ShorterURL : CDN Fallback : © 2013 Server Circle