==== ntfy-ssh-login ==== (Notify on SSH login (or other event)) This little script is called by the PAM daemon whenever there is a successful event in SSH, it ignores my own personal events, because I log in and out frequently, and don't want to hear my phone that much, just get rid of the first check if that's an issue. #!/usr/bin/bash # ntfy-ssh-login.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-login.sh # No login alerts for me... [ ${PAM_USER} == "xyzzy" ] && exit echo "SSH event on Tiny: User ${PAM_USER}, ${PAM_TYPE} from ${PAM_RHOST}" \ | mailx -s "SSH Alert" -r "Doom dude " 5135551111@tmomail.net