[blog.rayfoo] Infosec, DFIR, tech geekery, thoughts and whatnot

30Sep/090

Getting your server to send an email whenever anyone logs in

rubyinside-ad1-310x90Running on a VPS like Linode give me plenty of control over what is run, and also plenty of chances to learn more about network administration (along with the heartaches). :P

The code that I used was based from this forum post. This one presumes that your MTA has been setup properly. The original code was for protecting your root account (i.e. when anyone logs into your server's root account, you get the notification).

(Note: it is usually not advisable to login as root. Create a user account and give it sudoer rights instead. I'd say that's advisable even for servers where there is only one person expected to login, which is you.)