Regardless of user access, many times you have probably wanted to know when someone logs-in into your server. And it is pretty easy to setup your Linux server to send mail notification on user login event. Note that, if you have a system with many users who login few times a day, then you should expect a lot of mail traffic. To configure your Linux server to send mail on user logon event open your /root/.bashrc file and add the following line:
echo 'ALERT - Root Shell Access (`hostname -f`) on:' `date` `who` | mail -s "Alert: Root Access on `hostname -f` from `who | cut -d'(' -f2 | cut -d')' -f1`" email@example.com
If you want to manually add server name and not the FQDN, replace `hostname -f` with desired server name.