{"id":9992,"date":"2022-08-06T12:51:04","date_gmt":"2022-08-06T09:51:04","guid":{"rendered":"https:\/\/kifarunix.com\/?p=9992"},"modified":"2024-03-09T21:01:48","modified_gmt":"2024-03-09T18:01:48","slug":"lock-linux-user-account-after-multiple-failed-login-attempts","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/lock-linux-user-account-after-multiple-failed-login-attempts\/","title":{"rendered":"Lock Linux User Account after Multiple Failed Login Attempts"},"content":{"rendered":"\n

Follow through this guide to learn how to lock Linux user account after multiple failed login attempts. Linux through Pluggable Authentication Modules, PAM, can be configured to lock accounts after specific number of failed login attempts. Such are some of the security measures that aims at curbing brute force authentication attacks.<\/p>\n\n\n\n

This can be achieve specifically through pam_faillock<\/strong> module. pam_faillock<\/a> module maintains a list of failed authentication attempts per user during a specified interval and locks the account in case there were more than deny consecutive failed authentications.<\/em><\/p>\n\n\n\n

Normally, failed attempts to authenticate root user will not cause the root account to become blocked, to prevent denial-of-service: if your users aren’t given shell accounts and root may only login via su or at the machine console (not telnet\/ssh, etc), this is safe<\/strong><\/em>“, pam_faillock man page.<\/p>\n\n\n\n

Lock Linux User Account after Multiple Failed Login Attempts<\/h2>\n\n\n\n

Files to Update<\/h3>\n\n\n\n

As already stated, pam_faillock<\/code><\/strong> module can be used to limit the number of allowed failed logins within a specified time period on Linux systems before an account is locked.<\/p>\n\n\n\n

There are a number of files which you need to edit in order to define the failed authentication policies.<\/p>\n\n\n\n

These include;<\/p>\n\n\n\n

On CentOS and Similar Derivatives<\/p>\n\n\n\n