[mod_python] Session DBAccessError (permission denied)

Sean Davis sdavis2 at mail.nih.gov
Fri Oct 13 07:06:55 EDT 2006


On Friday 13 October 2006 05:03, Alex Greif wrote:
> Hi,
>
> with mod_python 3.2.10 and apache 2.2.3
>
> I have the following problem while saving session contents:
>
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher: Traceback (most recent call last):
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/agreif/fbxxl_home/usr_local/python/lib/python2.4/site-packages/mod_p
>ython/apache.py", line 299, in HandlerDispatch\n    result = object(req)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/agreif/fbxxl_home/usr_local/python/lib/python2.4/site-packages/mod_p
>ython/publisher.py", line 210, in handler\n    object = resolve_object(req,
> module,
> func_path, realm, user, passwd)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/agreif/fbxxl_home/usr_local/python/lib/python2.4/site-packages/mod_p
>ython/publisher.py", line 387, in resolve_object\n    realm, user, passwd =
> process_auth(req, obj, realm, user, passwd)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/agreif/fbxxl_home/usr_local/python/lib/python2.4/site-packages/mod_p
>ython/publisher.py", line 302, in process_auth\n    rc = __access__(req,
> user)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/fbxxl/usr_local/apache/scripts/admin.py", line 226, in
> __access__\n    return webutil.authorize(req=req, login=user,
> neededRole=neededRole)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/fbxxl/usr_local/apache/scripts/_util/webutil.py", line 47, in
> authorize\n    session.save()
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/agreif/fbxxl_home/usr_local/python/lib/python2.4/site-packages/mod_p
>ython/Session.py", line 244, in save\n    self.do_save(dict)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/agreif/fbxxl_home/usr_local/python/lib/python2.4/site-packages/mod_p
>ython/Session.py", line 370, in do_save\n    dbm = self._get_dbm()
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/agreif/fbxxl_home/usr_local/python/lib/python2.4/site-packages/mod_p
>ython/Session.py", line 345, in _get_dbm\n    result =
> self._dbmtype.open(self._dbmfile, 'c', stat.S_IRUSR | stat.S_IWUSR |
> stat.S_IRGRP)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/fbxxl/usr_local/python-2.4.3//lib/python2.4/anydbm.py", line
> 83, in open\n    return mod.open(file, flag, mode)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/fbxxl/usr_local/python-2.4.3//lib/python2.4/dbhash.py", line
> 16, in open\n    return bsddb.hashopen(file, flag, mode)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher:   File
> "/home/fbxxl/usr_local/python-2.4.3//lib/python2.4/bsddb/__init__.py",
> line 299, in hashopen\n    d.open(file, db.DB_HASH, flags, mode)
> [Fri Oct 13 10:38:26 2006] [error] [client 84.191.110.235]
> PythonHandler mod_python.publisher: DBAccessError: (13, 'Permission
> denied')
>
>
> createing a database manually works:
> Python 2.4.3 (#1, Aug 11 2006, 20:29:30)
> [GCC 2.95.3 20010315 (SuSE)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import anydbm
> >>> db = anydbm.open("/tmp/mp_sess_test.dbm",'c')

I'm not sure this is the answer, but remember that apache typically runs as a 
relatively unprivileged user (and NOT as you), so even though you are able to 
create a database manually, apache still might not be able to.  Make sure 
that apache can read and write to the directory that you are trying to use 
for session management.

Sean


More information about the Mod_python mailing list