SSH Login Notification

Someone might say I’m paranoid but i like to now when someone logs into my server.

Copy this into the file “/etc/ssh/sshrc” (Ubuntu/Debian) and change “” to your email address:

IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
echo ''$IP' logged into '$HOST'' | mutt -s 'SSH Login'

This example only works if you have configured the Mutt email client.