#!/usr/bin/bash # /etc/pam-scripts/ntfy-ssh-event.sh # This works with PAM, and appended to the bottom of /etc/pam.d/sshd; # # This should send an alert whenever anyone logs in; # session optional pam_exec.so /etc/pam-scripts/ntfy-ssh-event.sh # No login alerts for me... [ ${PAM_USER} == "steve" ] && exit echo "SSH event: ${PAM_TYPE}, ${PAM_USER} from ${PAM_RHOST} on ${HOSTNAME} at $(date +'%Y-%m-%d+%H:%M:%S')" | mailx -s "SSH Alert" 5135551111@tmomail.net