I am having an issue with a dead simple python script; called with pam_exec.
I added a line at the end of that file
session optional pam_exec.so /bin/python /usr/local/bin/pam_notify_python.py
pam_notify_python.py script contains a simple
print "Hello world"
Obviously, this is not working, but I do not understand why. The script is not printing anything when I
su user or simply
su, but when I start a new shell and manually execute
python /usr/local/bin/pam_notify_python.py it is working.
Did I miss something ?
Thanks for reading !
pam_exec(8) man page tells why:
stdout Per default the output of the executed command is written to /dev/null. With this option, the stdout output of the executed command is redirected to the calling application. It's in the responsibility of this application what happens with the output. The log option is ignored.
So you need to add
stdout to the line:
session optional pam_exec.so stdout /bin/python /usr/local/bin/pam_notify_python.py
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.