Watch as I awkwardly stumble through life

Root Login Email Notification

Posted by Marius Voila on February 08, 2010 in London, U.K . — 0 comments This post contains 115 words

Configuring your server so that when someone logs in with root or su, your server will notify you via email.

Please use an email address that is NOT hosted on your server as a hacker could merely delete the emails right off the server.

Login to your server with root

Use any editor to edit .bash_profile

At the end of the file, place the following lines:

echo 'ALERT - Root Shell Access on:' `date` `who` | mail -s "Alert: 
Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`"

*Note that the code is one line

Now anytime someone gains root access you will be notified via email.