

According to man on my computer, pam_exec doesn’t have any “dir” parameter, so you might need to remove that.
But it has a “log” parameter, so you could add “set +eux” to your script and add a “log=/tmp/loginalert.log” to the pam_exec call and see what the error message is. Or use the “stdout” option to make it output the errors to stdout on login for debugging.
It seems to me you’re requiring a subject and body text, but never setting any.








Sure, you’re right, I skipped past that. Maybe you need to add a few print statements as well. For example I don’t know when SSH_CONNECTION gets set. Maybe that’s not yet available if you use “account” instead of “session”.