Created
November 23, 2019 09:34
-
-
Save mikaelz/be7607ffc9509ced8940bf5ab1e46334 to your computer and use it in GitHub Desktop.
SSH login email notify. Inspired by https://askubuntu.com/a/702743/168459
This file contains 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
$ cat /etc/profile.d/ssh-login-notify.sh | |
if [ -n "$SSH_CLIENT" ]; then | |
TEXT="$(date): ssh login to ${USER}@$(hostnamectl --static)" | |
TEXT="$TEXT from $(echo $SSH_CLIENT|awk '{print $1}')" | |
echo $TEXT|mail -s "ssh login" info@example.com | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment