Friday, February 6, 2009

Root login email notification in Linux All Variant

Edit /root/.bashrc or /root/.bash_profile
Put this code inside .bashrc
echo 'ALERT - Root Shell Access `hostname` on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" email@myhost.com

0 comments: