I need to run a script, when the session is opened, as the user who's opening the session.
I have added in /etc/pam.d/common-session :
session optional pam_exec.so log=/tmp/test_pam_foo.log /usr/local/bin/test_pam_foo.sh
I also tried to activate pam_exec's option
The basic script /usr/local/bin/test_pam_foo.sh :
#!/bin/sh id -u >> /tmp/test_pam_foo id -ru >> /tmp/test_pam_foo
Unfortunately, I get all the time
0 as the effective id and real id.
Am I missing something?
That pam_script runs by default as the current user and has the option
runas to force to be run as root. But I'd like to privilege the use of pam libs that are already packaged in my distribution (Ubuntu 12.04).