Tag Archives: ssh

SSH Access Email Alert for bashrc

You want to know instantly who has logged in your ssh server. You can be emailed automatically including in .bashrc file of the user you want to monitor following commands:

 bash | 
 copy code |

echo 'ALERT - Root Shell Access (hostname) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" your@email.com