Monthly Archives: September 2014

Single line to send an alert mail from shell

The power of shell and how simple it is to send a mail when every some one logs in as root to a predefined email. echo ‘ALERT – Root Shell Access (message or DNS) on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d”(” -f2 | cut -d”)” -f1`” <email id>