i have a simply question about using PAM on linux to authenticate
user.

let's me explain my code.
we have a simple controller like this

def update():
   cache = apt.Cache()
   progress = apt.progress.TextFetchProgress()
   res = cache.update(progress)
   redirect(URL(r=request, c='statistic', f='index'))
   return dict(res = res)

cache.update(progress) was python-apt based function, that need "root"
or  sudoer" user to perform operation, likes apt-get update on debian-
based linux.
I have succesfully run this if i using su/sudo to start web2py, aka
like this $sudo python web2py.py
cache.update() can update apt database with this technique.
but if web2py run as a normal user with $python web2py, we know that
was run with specified password on prompt, but still can't run
cache.update because need of root privileges to access and lock apt
lock's file.

i think it is possible to use PAM method to accomply this.. like we
read on gluon/contrib/login_methods/pam_auth.py  said :
"""
    to use pam_login:
    from gluon.contrib.login_methods.pam_auth import pam_auth
    auth.settings.login_methods.append(pam_auth())

    or

    auth.settings.actions_disabled=[
       'register','change_password','request_reset_password']
    auth.settings.login_methods=[pam_auth()]

    The latter method will not store the user password in auth_user.
    """

i have try this suggestion, but still no luck..

any clue or some enlightenment for me ? thanks before

Reply via email to