Skip to content

Instantly share code, notes, and snippets.

@Lewiscowles1986
Created December 13, 2016 13:21
Show Gist options
  • Save Lewiscowles1986/4e33c8270357e87c50921a4bcb4b5544 to your computer and use it in GitHub Desktop.
Save Lewiscowles1986/4e33c8270357e87c50921a4bcb4b5544 to your computer and use it in GitHub Desktop.
Monitor SSH login to server
ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
logger -t ssh-wrapper $USER login from $ip
echo "User $USER just logged in from $ip" | mail -s "SSH Login" "CD2 Team <[email protected]>" &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment