Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
Do you have SELinux turned on? –  Ophidian Feb 20 '10 at 4:12
add comment

migrated from stackoverflow.com Feb 20 '10 at 2:19

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
+1 This came handy! –  Nirmal Jun 1 '12 at 4:01
add comment

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.
share|improve this answer
add comment

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
share|improve this answer
    
Thanks for the suggestion but I am still getting the same error. –  titaniumdecoy Feb 18 '10 at 18:43
add comment

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>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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