Global Linux Knowledge Base…
Monitor Failed Login Attempts
| In Linux you can use faillog command to display failed login attempts or you can set login failure limits. faillog formats the contents of the failure log from /var/log/faillog database / secure log file. It also can be used for maintains failure counters and limits. | |||||||||||||||
| For RHEL/CentOS Linux 5.x, you need to modify /etc/pam.d/system-auth file to monitor or track failed login attempts. You need to configure PAM module pam_tally.so. Otherwise faillog command will never display failed login attempts. | |||||||||||||||
| STEP 1: Open /etc/pam.d/system-auth file: | |||||||||||||||
| # vim /etc/pam.d/system-auth | |||||||||||||||
| Append following two pam_tally.so modules: | |||||||||||||||
|
|||||||||||||||
| Where, | |||||||||||||||
|
|||||||||||||||
| Save and close the file. | |||||||||||||||
| STEP 2: Now, to display failed login attempts for dhaval, | |||||||||||||||
|
# faillog -u dhaval |
|||||||||||||||
|
|||||||||||||||
| STEP 3: To display failed login attempts for all users, use the -a option: | |||||||||||||||
|
# faillog -a |
|||||||||||||||
|
|||||||||||||||
| If you want to reset the counter use -r option. If you want to reset particular users failed attempts, use -u USERNAME option: | |||||||||||||||
|
# faillog -r |
|||||||||||||||
|
# faillog -r -u dhaval |
|||||||||||||||
| Print article | This entry was posted by Dhaval Soni on October 8, 2010 at 10:33 PM, and is filed under All, CentOS, Fedora, Linux, Linux OS, Red Hat, Utilities. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |