#1  
Old 16th June 2007, 03: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?

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

Login attempts are automatically logged in /var/log/auth.log, so you just need to parse that log file.
__________________
Falko
--
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
  #3  
Old 12th July 2007, 22:19
robj robj is offline
Junior Member
 
Join Date: Jul 2007
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
 
Default

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:10.0.0.8 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
Reply

Bookmarks

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 13:20
Windows PHP interface with Linux box rocket1356 Programming/Scripts 3 8th June 2007 18:40
not receiving mail (postfix) lathrodectus General 7 28th June 2006 14:12
Problems installing NForce4 sound drivers Wraithfire Installation/Configuration 21 16th April 2006 17:30
KErnel not showing all my memory Jorem Kernel Questions 8 13th April 2006 12:59


All times are GMT +2. The time now is 20:55.


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