Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A shell script to email a notice upon user login' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A shell script to email a notice upon user login
Authored by: Black on Dec 08, '04 11:52:36AM
Rob is right that this isn't a terribly robust piece of security. Also, I'd think that opening Mail in the background and then closing it again would be a little annoying. If you really want to get this kind of notification when someone has logged into your account, a simple shell script would do:

#!/bin/sh
echo "Someone just logged in" | mail -s "Login notification" me@somewhere
Of course, the email address should be where you want the notification sent. if you wanted this to happen when you machine was actually booted, you could make this a system startup item (I'm sure the directions for doing that are around here somewhere).

[ Reply to This | # ]
A shell script to email a notice upon user login
Authored by: shemp9999 on Dec 08, '04 05:03:21PM
you can use a crontab to call the code at reboot.

@reboot echo "Someone just logged in" | mail -s "Login notification" me@somewhere


[ Reply to This | # ]