Matt Good wrote:
> Jackson wrote:
> > I was given a machine runnig SuSE Enterprise Linux 10 and told to set
> > up Trac and Subversion accessed via Apache. So, I have tried to do
> > that. Now, I am trying to configure auhorization. When I try to access
> > the Trac environment, I get the above message.
> > Apache is running as 'root' (bad idea, I know ...). So this makes no
> > sense. I solved the problem by "chmod -R 777 /var/trac", which seems
> > rather drastic.
>
> If that chmod worked, it suggests that Apache may not really be running
> as root.  I've seen that before where the username reported in the
> error message is "root" although Apache is not really running as root.
> When they drop permissions the $USER environment variable may still be
> set to "root" which is being picked up by Trac in that message.
>
> Set your permissions back to something sane:
> chmod -R 644 /var/trac
> find /var/trac -type d | xargs chmod 755
>
> Then apply this patch which I think should give you the right username
> in that error message:
>
> Index: trac/db/sqlite_backend.py
> ===================================================================
> --- trac/db/sqlite_backend.py   (revision 4297)
> +++ trac/db/sqlite_backend.py   (working copy)
> @@ -146,11 +146,12 @@
>              dbdir = os.path.dirname(path)
>              if not os.access(path, os.R_OK + os.W_OK) or \
>                     not os.access(dbdir, os.R_OK + os.W_OK):
> -                from getpass import getuser
> +                import pwd
> +                username = pwd.getpwuid(os.getuid())[0]
>                  raise TracError('The user %s requires read _and_ write
> ' \
>                                  'permission to the database file %s
> and the ' \
>                                  'directory it is located in.' \
> -                                % (getuser(), path))
> +                                % (username, path))
>
>          if have_pysqlite == 2:
>              self._active_cursors = weakref.WeakKeyDictionary()
>
>
> If that works I'll update Trac to use the "pwd" module instead of
> "getpass" when possible (it's not available on Windows).  Then you
> should be able to just make sure the Apache user owns the files in the
> Trac projects:
>
> chown -R www-data /var/trac
>
> Replacing www-data with the right user name.
>
> -- Matt Good

I tried your patch, however, still receiving error :

[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in
HandlerDispatch\n    result = object(req)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/web/modpython_frontend.py", line
87, in handler\n    gateway.run(dispatch_request)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/web/wsgi.py", line 87, in run\n
  response = application(self.environ, self._start_response)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/web/main.py", line 377, in
dispatch_request\n    env = _open_environment(env_path,
run_once=run_once)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/web/main.py", line 58, in
_open_environment\n    env_cache[env_path] = open_environment(env_path)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/env.py", line 435, in
open_environment\n    if env.needs_upgrade():
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/env.py", line 313, in
needs_upgrade\n    db = self.get_db_cnx()
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/env.py", line 182, in
get_db_cnx\n    return DatabaseManager(self).get_connection()
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/db/api.py", line 75, in
get_connection\n    return self._cnx_pool.get_cnx(self.timeout or None)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/db/pool.py", line 101, in
get_cnx\n    cnx = self._connector.get_connection(**self._kwargs)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py", line 113,
in get_connection\n    return SQLiteConnection(path, params)
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend:   File
"/usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py", line 150,
in __init__\n    raise TracError('The user %s requires read _and_ write
' \\
[Thu Jan 11 17:12:00 2007] [error] [client 172.16.59.147] PythonHandler
trac.web.modpython_frontend: TracError: The user apache requires read
_and_ write permission to the database file
/opt/trac/gsstoolbox/db/trac.db and the directory it is located in.


However, the perms are :
ll /opt/trac/gsstoolbox/db/trac.db
-rw-rw-r--  1 apache apache 445440 Jan 11 16:58
/opt/trac/gsstoolbox/db/trac.db

So not sure what other workarounds to try at this point

Thanks
adam


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Trac Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to