Created
December 19, 2017 14:38
-
-
Save dubcl/04b0cca5b943a938dad3b7a1103b407a to your computer and use it in GitHub Desktop.
notify ssh login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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