Modify

Opened 2 years ago

Last modified 3 months ago

#9970 reopened defect

Only root may execute trac-admin commands

Reported by: jan.zilka@… Owned by: mrelbe
Priority: high Component: TracTicketChangesetsPlugin
Severity: major Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

Only root may execute trac-admin commands, which prevents me to allow "apache" user to execute trac-admin commands within pre-commit and pre-revprop-change subversion hooks scripts.

Even root encounters error when invoking command help (see example below). That may be caused by something in file "console.py" of trac installation, or, "admin.py" from ticketchangesetsplugin .

[root@my_server hooks]# trac-admin /home/trac/project7 ticket_changesets help
Error: Command not found

ticket_changesets diff

    Examine ticket commit messages before reformat

ticket_changesets get [ticketid]

    Get a comma-separated list of related revisions.

ticket_changesets reformat

    Reformat ticket commit messages (DANGEROUS!)

ticket_changesets resync

    Re-synchronize ticket changesets with all repositories

root

[root@my_server admin]# trac-admin /home/trac/project7 ?
trac-admin - The Trac Administration Console 0.12.2

Usage: trac-admin </path/to/projenv> [command [subcommand] [option ...]]

Invoking trac-admin without command starts interactive mode.

help                        Show documentation
initenv                     Create and initialize a new environment
attachment add              Attach a file to a resource
...
...
ticket remove               Remove ticket
ticket_changesets diff      Examine ticket commit messages before reformat
ticket_changesets get       Get a comma-separated list of related revisions.
ticket_changesets reformat  Reformat ticket commit messages (DANGEROUS!)
ticket_changesets resync    Re-synchronize ticket changesets with all repositories
ticket_type add             Add a ticket type
...
wiki replace                Replace the content of wiki pages from files (DANGEROUS!)
wiki upgrade                Upgrade default wiki pages to current version

apache (non-root)

[apache_user@my_server admin]# trac-admin /home/trac/project7 ?
trac-admin - The Trac Administration Console 0.12.2

Usage: trac-admin </path/to/projenv> [command [subcommand] [option ...]]

Invoking trac-admin without command starts interactive mode.

help                        Show documentation
initenv                     Create and initialize a new environment
attachment add              Attach a file to a resource
...
...
ticket remove               Remove ticket
ticket_type add             Add a ticket type
...
wiki replace                Replace the content of wiki pages from files (DANGEROUS!)
wiki upgrade                Upgrade default wiki pages to current version
}}}}}}
see, that ticket_changesets commands are missing here. Why?

Attachments (0)

Change History (6)

comment:1 Changed 2 years ago by mrelbe

  • Status changed from new to assigned

Weird, I'll try to have a look at this when I get the time do get my act together (this plugin is really suffering from lack of time from my part).

However, I'm only running Trac och Windows environments and have limited experience with user account policies (though a restricted apache user is running here as well, I have not noticed this problem).

comment:2 follow-up: Changed 18 months ago by anonymous

This looks more like a problem with permissions in this particular Trac instance rather than problems in the plugin itself. In fact, it seems to me that it is not related to TracTicketChangesetsPlugin at all. In Trac 0.12 you need to run post-commit hooks containing trac-admin commands, but that's just Trac. The fact that you are trying to run as root at all is probably part of the problem, as files created by root might not be readable/writable to the apache user.
Just my 2 cents, I was actually looking into using this plugin and was at first reluctant when I saw the ticket, but after reading it I think it should be marked invalid.

comment:3 in reply to: ↑ 2 Changed 18 months ago by mrelbe

  • Resolution set to worksforme
  • Status changed from assigned to closed

Replying to anonymous:

This looks more like a problem with permissions in this particular Trac instance rather than problems in the plugin itself. In fact, it seems to me that it is not related to TracTicketChangesetsPlugin at all.

I think so to.

comment:4 Changed 18 months ago by rjollos

  • Description modified (diff)

comment:5 Changed 14 months ago by rdeman

I was testing this on Trac 1.0.1 and I am getting this when running as root or as normal user.. same thing

Error: Command not found

No documentation found for 'ticket_changesets'. Use 'help' to see the list of commands.

Did you mean one of these?
    changeset
    ticket_type
    ticket

comment:6 Changed 14 months ago by anonymous

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Add Comment

Modify Ticket

Action
as reopened .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.