Then get into the directory /root
# cd /root
The using your favorite editor, edit the file ".bashrc"
# vi .bashrc
Go to the end of the file. And insert the following line.
echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" you@yourdomain.com
Replace the following in the line with your variables.
YourserverName = Server hostname or Server IP address
you@yourdomain.com = Your mail id where you would like to receive the alert.
You are DONE!! Now if you login to the server, you will be receiving email alert at you@yourdomain.com.
No comments:
Post a Comment