Skip to content

Instantly share code, notes, and snippets.

@fimdomeio
Created December 30, 2014 16:34
Show Gist options
  • Save fimdomeio/937b59f3c04a7a2eb0c3 to your computer and use it in GitHub Desktop.
Save fimdomeio/937b59f3c04a7a2eb0c3 to your computer and use it in GitHub Desktop.
be warned via xmpp every time a user logs in you linux machine
#you'll need xsend.py script from http://xmpppy.sourceforge.net/examples/xsend.py . it's easy enough to get the dependencies
#/etc/pam.d/sshd
session optional pam_exec.so seteuid /home/YOURUSER/sshlogincmd.sh
#~/sshlogincmd.sh
#!/bin/bash
if [ $PAM_TYPE = "open_session" ]; then
/usr/bin/python /home/YOURUSER/xsend/xsend.py youxmmpuser@example.com user $PAM_USER \($PAM_RHOST\) $PAM_TYPE logged in on $HOSTNAME &
fi
$SSH_ORIGINAL_COMMAND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment