Edgewall Software

Opened 14 years ago

Last modified 13 years ago

#9538 closed defect

Trac-admin only recognises Environment when run using sudo — at Version 2

Reported by: hankaspank@… Owned by: Remy Blank
Priority: normal Milestone: 0.12.1
Component: admin/console Version: 0.12-stable
Severity: normal Keywords:
Cc: leho@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Remy Blank)

After upgrading to trac 0.12 and trying to use explicit synchronization I have realised that the trac-admin tool only works when run using sudo. This is an issue when trying to use explicit sync using svn hooks as the svn hook scripts are run as the apache user.

I have tried removing trac 0.12 installation files(trac-admin files and .egg) and reinstalling using easy_install but it hasn't made a difference.

Couldn't find a similar issue.

Example

andrew@li189-190:/etc/apache2/sites-available$ trac-admin /var/projects/trac/monkey/
Welcome to trac-admin 0.12
Interactive Trac administration console.
Copyright (c) 2003-2010 Edgewall Software

Type:  '?' or 'help' for help on commands.
        
Trac [/var/projects/trac/monkey]> ?
trac-admin - The Trac Administration Console 0.12
help     Show documentation
initenv  Create and initialize a new environment
Trac [/var/projects/trac/monkey]> exit

andrew@li189-190:/etc/apache2/sites-available$ sudo trac-admin /var/projects/trac/monkey/
Welcome to trac-admin 0.12
Interactive Trac administration console.
Copyright (c) 2003-2010 Edgewall Software

Type:  '?' or 'help' for help on commands.
        
Trac [/var/projects/trac/monkey]> ?
trac-admin - The Trac Administration Console 0.12
help                 Show documentation
initenv              Create and initialize a new environment
attachment add       Attach a file to a resource
attachment export    Export an attachment from a resource to a file or stdout
attachment list      List attachments of a resource
attachment remove    Remove an attachment from a resource
changeset added      Notify trac about changesets added to a repository
changeset modified   Notify trac about changesets modified in a repository
component add        Add a new component
component chown      Change component ownership
component list       Show available components
component remove     Remove/uninstall a component
component rename     Rename a component
config get           Get the value of the given option in "trac.ini"
config remove        Remove the specified option from "trac.ini"
config set           Set the value for the given option in "trac.ini"
deploy               Extract static resources from Trac and all plugins
hotcopy              Make a hot backup copy of an environment
milestone add        Add milestone
milestone completed  Set milestone complete date
milestone due        Set milestone due date
milestone list       Show milestones
milestone remove     Remove milestone
milestone rename     Rename milestone
permission add       Add a new permission rule
permission list      List permission rules

System Information

OS ubuntu 10.04LTS
Trac 	0.12
Genshi 	0.6
mod_python 	3.3.1
pysqlite 	2.4.1
Python 	2.6.5 (r265:79063, Apr 16 2010, 13:28:26) [GCC 4.4.3]
setuptools 	0.6
SQLite 	3.6.22
Subversion 	1.6.6 (r40053)
jQuery:	1.4.2

Installed Plugins

TracAccountManager 	0.2.1dev 	/usr/lib/pymodules/python2.6
TracDoxygen 	0.11.0.2 	/usr/local/lib/python2.6/dist-packages/TracDoxygen-0.11.0.2-py2.6.egg

Change History (2)

comment:1 by hankaspank@…, 14 years ago

Further example run as sudo

Trac [/var/projects/trac/monkey]> changeset added default 307
Trac [/var/projects/trac/monkey]> 

run as user

Trac [/var/projects/trac/stockmonkey]> changeset added default 307
Error: Command not found

comment:2 by Remy Blank, 14 years ago

Description: modified (diff)
Milestone: 0.12.1
Owner: set to Remy Blank

Of course, the user running trac-admin must have write permission to the whole environment. In the standard configuration (both SVN and Trac served via HTTP by Apache), this is usually the case, as the apache user has write access to both the SVN repository and the Trac environment. But if you access the repository e.g. through svn+ssh, you will have to set up sudo.

But in your case, you say that the apache user doesn't have write access to the Trac environment? I thought mod_python would run under the web server's user, isn't that the case?

This is pretty much an InstallationIssue, but we should add a note about su TracRepositoryAdmin. I'll do that.

Note: See TracTickets for help on using tickets.