Receive a push notification on your phone every time someone logs into your server.
Currently prepared for the iOS-only app Prowl. However, adapting to an Android solution like NotifyMyAndroid should be quite easy.
Instructions:
-
Install cURL and check time zone:
apt install curl && dpkg-reconfigure tzdata
-
Copy login-notify.sh to a suitable place, I chose /root/ and make it executable:
chmod +x login-notify.sh
-
Grab your API key and paste it into login-notify.sh
-
Add the following line to /etc/pam.d/common-session and /etc/pam.d/sudo
session optional pam_exec.so /root/login-notify.sh
-
Make sure you double check the path to this script in the line you just pasted.
-
Receive lots of notifications.
Thanks to StalkR for the great inspiration:
https://blog.stalkr.net/2010/11/login-notifications-pamexec-scripting.html
License: MIT