PAM authentication problem
Asked Answered
C

3

5

I am using this module to authenticate using pam: http://code.google.com/p/web2py/source/browse/gluon/contrib/pam.py

I can call authenticate('username','password') and it returns True/ False. It works for any 'username' but 'root'. My guess is that there is a security restriction in PAM that does not allow to check for the root password.

I need to be able to check the root password. Is there anything I can change in the pam.conf or somewhere else to remove this restriction?

Central answered 30/4, 2010 at 18:56 Comment(0)
Q
4

I found the answer to your question, the problem is in the default service.

when you call the function authenticate('username','password') make sure you pass an appropriate service too. like authenticate('username','password', 'passwd') or you can add your custom configuration under /etc/pam.d/

here is an example from the webmin project

#%PAM-1.0
auth    required    pam_unix.so nullok
account required    pam_unix.so
session required    pam_unix.so

write the previous lines on a file under /etc/pam.d/ and call it 'myconfig' for example, then pass it's name to the function, and it'll work (it did for me) :D

Quarterhour answered 3/5, 2010 at 4:25 Comment(0)
B
3

I had the same issue root was not getting authenticated. Here's the fix.

If you use the service 'login' ,it won't work for root. Use,

#authenticate('username','password',service='system-auth')
Belvabelvedere answered 25/11, 2012 at 2:41 Comment(1)
Thanks, It worked for me , our authentication is not based on local file.Muskogean
P
0

You could use sshd configuration if its a system with ssh server running and should work for root.

authenticate('root','password',service='sshd')

Pinwheel answered 25/9, 2018 at 19:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.