How to resolve suexec policy violation causing error 500 using git-http-backend?

Luke picture Luke · Sep 9, 2012 · Viewed 9.4k times · Source

I'm trying to get git-http-backend working on my remote vps with no luck. I've adjusted httpd.conf in a way similar to the on this question, but as soon as I add the ScriptAlias directive, the error occurs.

Apache error log:

 suexec policy violation: see suexec log for more details
 Premature end of script headers: git-http-backend

Suexec log

 error: target uid/gid (503/500) mismatch with directory (0/0) or program (0/0) or trusted user (0/10)

Can anyone comment on how one normally solves suexec problems?

EDIT

The main problem seemed to be that the web server is not allowed to run cgi scripts.

The documentation on configuring suexec is beyond me at the moment. I've chosen to disable it for now, which allows the web server to run these scripts. I can now successfully push to the repo. I found this article helpful.

Answer

doweio picture doweio · Sep 18, 2014

I had this error while setting up moinmoin. I suspect it's both lines you need to pay attention to (which in my case, were):

[2014-09-18 17:17:18]: uid: (1009/testsite) gid: (1006/testsite) cmd: moin.cgi
[2014-09-18 17:17:18]: target uid/gid (1009/1006) mismatch with directory (0/0) or program (0/0)

The first line is stating that a process - in this case owned by testsite:testsite - is attempting to execute a command (moin.cgi).

It then checks the calling process's user id/group id to see if it matches the command to be executed, which triggers the second output when it fails (0/0 indicates root/root).

Simply calling chown should fix it:

chown -R testsite:testsite </path/to/directory-or-binary>