Linux – Cannot commit to SVN repository via http

httphttpd.conflinuxsvn

When I try to import a project into my subversion repository via http, I get this error:

Can't create directory '/usr/local/svn/myproj/db/transactions/0-1.txn': Permission denied

I set the httpd LogLevel to debug and got this at the end of the output:

[Wed Feb 17 23:56:33 2010] [error] [client 24.205.225.190] Could not create activity /svn/myproj/!svn/act/9c0a8481-8edd-4be0-be2d-164c700616ba.  [500, #0]
[Wed Feb 17 23:56:33 2010] [error] [client 24.205.225.190] could not begin a transaction  [500, #13]
[Wed Feb 17 23:56:33 2010] [error] [client 24.205.225.190] Can't create directory '/usr/local/svn/myproj/db/transactions/0-1.txn': Permission denied  [500, #13]

Here is the relevant section of my httpd.conf file:

<Location /svn>
    DAV svn
    SVNParentPath /usr/local/svn
    AuthType Basic
    AuthName "Subversion Repositories"
    AuthUserFile /etc/svn-auth-conf
    Require valid-user
</Location>

I am trying to import a project from NetBeans using the URL http://myhostname/svn/myproj.

I am using CentOS linux.

The fixes for this problem I have found online are to set the repository (and enclosing folder) to belong to the apache user and modify the permissions of the same. I have tried the following without success:

$ chown -R apache.apache /usr/local/svn
$ chmod -R 755 /usr/local/svn
$ service httpd restart

I can't figure out what else to try. Please help!

Best Answer

I would guess that you have SELinux turned on (normal for the default install of CentOS). I believe that the security policy for httpd forbids it accessing files outside of /var/www by default. It certainly does not allow access to /usr/local. Using /var/www/svn as the repository location will prevent access denials by SELinux.