2

I know that to integrate my module with the passwd command all I need to do is add the following line to the /etc/pam.d/passwd file:

password sufficient mymodule.so 

My question is I want my module only to be called if the user calling logged in using my module, otherwise I want the common-password to be called.. How can I do this?

I have another configuration file that calls the service authentication from my module.. My issue is to know whether the person calling passwd has logged in using my module, or another one in order to call ( or not ) my module for the password service..

  • To clarify, if a user is logging in with program foo then use your module. Else, use a different module. Do I understand that correctly? – SailorCire Oct 19 '14 at 17:49
  • the problem is not about the login. yes i have an app that does use my configuration file that has the auth service, and yes, there are other programs that use the auth service from another module.. thats not the problem.. the problem is to integrate the module to the passwd and when someone has logged using my app then passwd should call my module but if it has logged in using some other module then passwd needs to call the common-password – gonza1207 Oct 19 '14 at 17:51
  • Oh, so a user logs in with your program and then runs passwd. At that time and at that time only, use your module. If they run passwd any other way, use the default passwd related modules. – SailorCire Oct 19 '14 at 17:54
  • yes... the thing is how to do that.. – gonza1207 Oct 19 '14 at 18:05
  • I'm afraid you'll have to keep that information stored somewhere independently (a good place for this sort of information is in /var or /run), always load your module and then check whether it should just fall through or actually do its stuff. – peterph Oct 19 '14 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.