Hi I have been trying to follow the information about pam_exec from here: Ssh login hook?
When a user log's in they get:
/etc/pam.d/email-alert.sh failed: exit code 8
My sshd file has this at the end:
session optional pam_exec.so debug seteuid /etc/pam.d/email-alert.sh
My email-alert.sh script has this,
echo 'ALERT - Remote SSH Shell Access (SERVERNAME) on:' `date` `who` | mail -s "Alert: Remote SSH Access from `who | cut -d'(' -f2 | cut -d')' -f1`" MYEMAIL@MYEMAIL.com
I have tested the script on its own and it emails me no problem.
If anyone could point me in the right direction it would be much appreciated as I've been scratching me brain's out trying to figure it out.