Hi All,
For a better security method we can set a Mail alert when someone Login to our Servers as Root .
In order to set this we need to edit the .bashrc file
# vi .bashrcAdd the following line below in .bashrc file
# echo -n 'ALERT - Root Shell Access (servername) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" email addressWe can also set this method when someone access through SSH.
Goto the directory
cd /root/.sshCreate a file name "
rc"
# vi rcAdd the following line in the new "rc" file
echo -n 'ALERT - Root Shell Access (servername) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" email address That's It