2

I set up SVN on Ubuntu using the tutorial How to set up a Subversion (SVN) server on GNU/Linux - Ubuntu, but when I try access the repository from other machine using CMD it says Access to /SVN is forbidden.

I changed the permission of the folder and tried other methods to resolve the issue like configuration of the Apache server, but that did not solve my problem.

How can I fix this problem?

Community
  • 1
  • 1
Najam-us-Saqib
  • 526
  • 3
  • 10
  • 23

3 Answers3

4

Apache can read and write the repository, but its user (www-data) needs to be given ownership of it:

sudo chown -R www-data:www-data /var/svn/repositories/your_repo

To be able to authenticate users who access the repository a password file is needed:

sudo htpasswd -c /etc/subversion/passwd your_user_name

Enter a password for the user your_user_name. For additional users repeat the command without the -c option to make sure the existing file is appended to rather than replaced.

Then edit the Apache configuration file:

sudo gedit /etc/apache2/apache2.conf

Add the following to the end of the file:

#svn users
<Location /svn>
     DAV svn
     SVNParentPath /var/svn/repositories/
     SVNListParentPath On
     AuthType Basic
     AuthName "Test"
     AuthUserFile /etc/subversion/passwd
     <LimitExcept GET PROPFIND OPTIONS REPORT>
        Require valid-user
     </LimitExcept>
  </Location>

Save the configuration file and restart Apache:

sudo /etc/init.d/apache2 restart

The test repository can now be accessed via:

http://localhost/svn/your_repo
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Shafeeque
  • 2,039
  • 2
  • 13
  • 28
1

Make sure you have your virtual host set up like this for Apache:

<VirtualHost *:80>
    DocumentRoot /home/svn/html
    ServerName svn.domainname
    ErrorLog logs/svn.domain.com-error_log
    CustomLog logs/svn.domain.com-access_log common

    <Directory "/home/svn/html">
        Order allow,deny
        Allow from all
        AllowOverride all
    </Directory>

    <Location /repos>
        DAV svn
        SVNParentPath /home/svn/repos

        Require valid-user
        SVNListParentPath on
        AuthType Basic
        AuthName "Your Super SVN"
        AuthUserFile /home/svn/svn-passwords-file-to-be-used-only-when-AuthType-is-used
        AuthzSVNAccessFile /home/svn/svn-repos-acl-file-but-optional
    </Location>
</VirtualHost>

And make sure Apache can access the repos folder mentioned in SVNParentPath. This issue is mostly because of permissions. Try chmod -R 0777 repos-folder and try again.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Balwant Singh
  • 287
  • 5
  • 14
  • I have to give this **site-enabled** in apache? – Najam-us-Saqib Nov 05 '13 at 10:03
  • This is a Virtual host configuration. Read [How to add a virtual host in apache](http://www.thegeekstuff.com/2011/07/apache-virtual-host/). and then you will understand well. – Balwant Singh Nov 05 '13 at 12:22
  • actually I want to ask this in ubuntu. I know how to add virtual host in apache but that is in windows, I want to ask for the linux environment. As we have different configuration files in ubuntu.... – Najam-us-Saqib Nov 05 '13 at 12:40
  • if you want to do it in ubuntu, the file to the config file is generally : `/etc/http/conf/httpd.conf` . Before looking into that look for `subversion.conf` under `/etc/httpd/conf.d` . If that file exists, it must be auto loading those files. so edit that accordingly. – Balwant Singh Nov 06 '13 at 12:19
0

This might help someone if they are troubleshooting a setup that had previously been working. Today the new guy at our company inadvertently introduced a typo in the file used by AuthzSVNAccessFile and that caused all of us to experience the dreaded E175013

Jeff
  • 2,095
  • 25
  • 18