Skip to content

Instantly share code, notes, and snippets.

@dubcl
Created December 19, 2017 14:38
Show Gist options
  • Save dubcl/04b0cca5b943a938dad3b7a1103b407a to your computer and use it in GitHub Desktop.
Save dubcl/04b0cca5b943a938dad3b7a1103b407a to your computer and use it in GitHub Desktop.
notify ssh login
# put on .bashrc .zshrc or whatever
SSHIP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
HOSTNAME=$(hostname)
NOW=$(date +"%e %b %Y, %a %r")
echo 'Someone from '$SSHIP' logged into '$HOSTNAME' on '$NOW'.' | mail -s 'SSH Login Notification' [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment