Receive notifications when someone logs in on your Server

Loging as root to your server and:

Edit bash_profile
# nano .bash_profile

Now, add to the bottom of the file:

echo 'ALERT - Root Shell Access on:' `date` `who` mail -s "Root has been loged into by `who awk '{print $6}'`" youremail@yourdomain.com

Now, you will receive a notification on your email when someone logs in as root on your server. Note that if possible you should intert and "offside" email address in order to keep sure that you receive if your system is compromised.

0 Comments: