howto: Generate Email with SSH access February 10, 2009Posted by hasnain110 in Linux.
Here are few steps to enable the system shoot email when ever someone access the SSH
So lets get started!
1. Login to your server and su to root
2. cd /root
3. pico .bashrc
4. Scroll to the end of the file then add the following:
echo ‘ALERT – Root Shell Access (YourserverName) on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d”(” -f2 | cut -d”)” -f1`” email@example.com
Replace YourServerName with the handle for your actual server
Replace firstname.lastname@example.org with your actual email address
Note: make sure the system can access internet