Old 16th June 2007, 04:01
cowboy_1 cowboy_1 is offline
Junior Member
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linux Script

I need help writing a Linux script that automatically saves login attempts of 2 or more into a file, and then emails that file to myself or one of my administrators. Can any one help? Or at least point me in a different direction than these constant tutorial sites?

Reply With Quote
Sponsored Links
Old 17th June 2007, 14:46
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts

Login attempts are automatically logged in /var/log/auth.log, so you just need to parse that log file.
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Old 12th July 2007, 23:19
robj robj is offline
Junior Member
Join Date: Jul 2007
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts

I would put a daily cron job in so I could check the report every morning.

Maybe something like this:

cat /var/log/secure | grep "Failed password" | mail -s "$HOSTNAME Login Report" support@localdomain.co.uk

Then you would get a mail with this kind of body:

Jul 12 21:09:42 server sshd[24161]: Failed password for testuser2 from ::ffff: port 3973 ssh2

This works on Redhat/CentOS systems, just change the log and the phrase your looking for if you need to...
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please Help me Port Almost any Linux distro to the MS Xbox raid517 HOWTO-Related Questions 5 16th June 2007 14:20
Windows PHP interface with Linux box rocket1356 Programming/Scripts 3 8th June 2007 19:40
not receiving mail (postfix) lathrodectus General 7 28th June 2006 15:12
Problems installing NForce4 sound drivers Wraithfire Installation/Configuration 21 16th April 2006 18:30
KErnel not showing all my memory Jorem Kernel Questions 8 13th April 2006 13:59

All times are GMT +2. The time now is 00:31.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.