E-mail Alert on Root SSH Login
« on: November 26, 2008, 10:35:22 AM »
It is essential that you have been notified whenever someone login to your server. On the server, you can set an email alert when someone login to your server as root.

[1] Login to your server as a root user.

[2] Type the below command:
Code: [Select]
pico /root/.bashrc
[3] Scroll down to the end of the file and add the following line:

echo 'Root Shell Access on your [ServerName] on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" <a href="mailto:email@yourdomain.com">email@yourdomain.com</a>

[4] Save the file and exit from SSH. Now login to your server and check whether you are receiving the email alert or not.

Regards,

Kevin
« Last Edit: July 16, 2009, 11:03:38 AM by Kailash »