LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I am not able to recieve password by expose_authtok option of pam_exec module. (https://www.linuxquestions.org/questions/linux-newbie-8/i-am-not-able-to-recieve-password-by-expose_authtok-option-of-pam_exec-module-4175496625/)

Pooja2505 02-28-2014 11:35 PM

I am not able to recieve password by expose_authtok option of pam_exec module.
 
HI All,

Please answer the below query.It is very urgent.

I want to recieve the passsword given by user at login time,in a variabe to validate it against some rules.
I have read about pam_exec.so gives the password to the calling script at stdin by using expose_authtok option.

But i am not able to recieve the password in my script.Can anyone help me how can i retrieve the password given by user at login time.

redd9 03-01-2014 01:37 AM

Well, can we see your script?

Pooja2505 03-01-2014 08:17 AM

Here is what my script looked like -

In /etc/pam.d/system-auth i have added a line for calling pam_exec.so library file -

session required pam_exec.so expose_authtok /etc/my.sh

The /etc/my.sh script contains the following -

#!/bin/bash

read password
echo "$password" > /tmp/a.txt

my.sh has 755 permissions and so does a.txt.

I know that for recieving password we should use auth instead of session but when i use auth then my script does not get called.That's why i used session.
But i have tried with auth too and by using auth also i am not able to get password.


Please help me if you know the answer or if u know another alternative to fetch linux original password.


All times are GMT -5. The time now is 01:46 AM.