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 /etc/pam.d/common-session
:
session optional pam_exec.so /bin/python /usr/local/bin/pam_notify_python.py
The 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 !
Best Answer
The
pam_exec(8)
man page tells why:So you need to add
stdout
to the line: