Skip to content

Instantly share code, notes, and snippets.

Last active May 12, 2022 07:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save channprj/9be66d29e940444467b034e71d086ec7 to your computer and use it in GitHub Desktop.
Simple SSH Login Notifier via PAM
# Create trigger file
touch /etc/ssh/
chmod +x /etc/ssh/
vim /etc/ssh/
# /etc/ssh/
if [ ${PAM_TYPE} = "open_session" ]; then
curl -s -X POST "${BOT_TOKEN}/sendMessage" -d chat_id="${CHAT_ID}" -d text="${MESSAGE}" > /dev/null 2>&1
# Test trigger
PAM_TYPE="open_session" /etc/ssh/
vim /etc/pam.d/sshd
# Add below:
# Notify SSH Login to Telegram
session optional /etc/ssh/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment