Skip to content

Instantly share code, notes, and snippets.

@genothomas
Forked from cmaster11/Markdium-Shell.bash
Created April 11, 2020 04:29
Show Gist options
  • Save genothomas/22abd967b281bf2434341c961348575f to your computer and use it in GitHub Desktop.
Save genothomas/22abd967b281bf2434341c961348575f to your computer and use it in GitHub Desktop.
Markdium-How to get notified whenever someone logs in via SSH?
if [[ -n $SSH_CONNECTION ]] ; then
read -r -d '' CONTENT <<-EOF || true
Now UTC: $(date --utc "+%F %T")
Env:
$(printenv)
EOF
curl -s -X POST "https://hook.notify17.net/api/raw/REPLACE_WITH_YOUR_API_KEY" \
-F title="SSH - User $USER logged in" \
-F content="$CONTENT" > /dev/null || true
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment