2

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!

1
  • Do you have SELinux turned on?
    – Ophidian
    Feb 20, 2010 at 4:12

4 Answers 4

1

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.

3
  • Other than turning SELinux off, do you know which boolean in SELinux is responsible for this behaviour? Turning SELinux off does stop this from happening, but I'd rather have SELinux on, and the appropriate boolean adjusted to permit this.
    – Warwick
    Sep 26, 2014 at 6:16
  • 1
    Got it working using the following: chcon -R --type httpd_sys_content_t /svn semanage fcontext -a --type httpd_sys_content_t '/svn(/.*)?'
    – Warwick
    Sep 30, 2014 at 5:46
  • 1
    I had to add on top of httpd_sys_content_t also httpd_sys_rw_content_t, only then I could commit in the new repo.
    – lzdt
    Jun 28, 2017 at 10:00
1

Did you already create or move an existing repository directory to this location?

svnadmin create /usr/local/svn/insert_your_projectname

Then update the permissions

chown -R httpd:httpd /usr/local/svn
chmod -R 755 /usr/local/svn
service httpd restart
1
  • Thanks for the suggestion but I am still getting the same error. Feb 18, 2010 at 18:43
1

You can setup SVN at SVNParentPath /usr/local/svn or any path that you want, but you have to do something.

Follow this step.

  run command 
                chcon -t httpd_sys_content_t  /usr/local/svn

Ps, - chcon is command relabels files.

- The httpd_sys_content_t type allows the httpd process to access that file.
0

I got it working with the following changes, although I'm not sure which was the problem.

I moved the svn directory to /var/www and made the following changes to the httpd.conf file:

<Location /svn>
    DAV svn
    SVNParentPath /var/www/svn
    <LimitExcept GET PROPFIND OPTIONS REPORT>
        AuthType Basic
        AuthName "Subversion Repositories"
        AuthUserFile /etc/svn-auth-conf
        Require valid-user
    </LimitExcept>
</Location>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.