Sunday, June 29, 2008

SSH login notification email

Add this to end of /root/.bashrc

echo 'ALERT - Root Shell Access on:" `date` `who` |mail -s "Alert: Root shell access from `who | cut -d"(" -f2 | cut -d")" -f1`" you@yourdomain.com

Then: service sshd restart

*Note: DO replace "you@yourdomain.com" with the notification address.

No comments: