tags:

views:

573

answers:

3

I'm trying to configure SVN web access on Apache2 under Windows Server 2008 for different write permissions.

I have next Apache2 conf:

<Location /svn>
 SVNParentPath "E:\SVN"

 DAV svn
 SVNListParentPath on
 AuthType Basic
 AuthName "Subversion repositories"
 Require valid-user

 AuthUserFile svn-auth.txt
 AuthzSVNAccessFile svn-acl.txt
</Location>

<Location /svn/foobar>
 SVNParentPath "E:\SVN\foobar"

 DAV svn
 SVNListParentPath on
 AuthType Basic
 AuthName "Subversion repositories"
 Require valid-user

 AuthUserFile svn-auth.txt
 AuthzSVNAccessFile svn-acl.txt
</Location>

E:\SVN is a root directory for all repositories - I want to list the all. It contains E:\SVN\test - is a project repository.

and E:\SVN\foobar - is a sub-root directory containing E:\SVN\foobar\foo and E:\SVN\foobar\bar - project repositories.

File svn-auth.txt contains a number of user passwords generated by htpasswd.exe

File svn-acl.txt contains a write access rules, but it doesn't work! Event it contains only one global permission:

[/]
* = rw

What is the different between SVNPath and SVNParentPath in Apache2 config for SVN? Maybe it would be make a sense?

And of course it doesn't work too if I add a group or a user:

[groups]
full = abatishchev

[/]
* = r
@full = rw
abatishchev = rw

I'm getting 403 Forbiden.

What am I doing wrong? TIA!

Update: I found a record from error.log:

The URI does not contain the name of a repository.  [403, #190001]

What could it mean?

+2  A: 

SVNPath is for one repository, SVNParentPath is for a root directory containing several repositories. So you should remove your second location in the Apache configuration file because it conflicts with the first if you try to access http://&lt;host&gt;/svn/foobar.

You should put absolute paths for the access and authentication files, make sure the Apache service has read/write access to the parent directory and all the repositories, and read access to those access and authentication files, it is often overlooked in manual installations.

For example:

<Location /svn>
    RedirectMatch ^(/svn)$ $1/
    SVNParentPath E:\SVN

    DAV svn
    SVNListParentPath on
    AuthType Basic
    AuthName "Subversion repositories"
    Require valid-user

    AuthUserFile C:\SVN\conf\svn-auth.txt
    AuthzSVNAccessFile C:\SVN\conf\svn-acl.txt
</Location>

You will find all the necessary information in Version Control with Subversion (this is the link to the latest version, though the Apache configuration settings haven't changed lately).

Then you should be able to specify global or individual permissions for groups and users, for your repositories. Examples of that can be found here, with the name you gave:

[groups]
full = abatishchev, anotherguy
main = abatishchev

[/]
* = r
@full = rw
abatishchev = rw

[foobar:/]
* =
@main = rw
full = r

[otherproject:/]
@main = rw
full = r

In this example, you have set general rules in [/], then particular rules that will prevail for foorbar (and everything below), and otherproject. You can even specify specific rules for individual directories of a repository.

RedGlyph
Thanks! I have my secondary apache config entry because e:\svn could contains e:\svn\foo (repo) and e:\svn\bar (directory with number of repos). So every repos root directory requires own Location entry
abatishchev
You can use regular expressions in the Apache `Location` directive to exclude secondary roots, maybe that could help to separate both and avoid the conflict. If you need several subdirectories that could get awkward after a while: an `svnserve` SVN server allows for arbitrary repository structures which would make your configuration much simpler (you can have subdirectories, no need to specify them). It is also less heavy and reduces the network bandwidth.
RedGlyph
Your idea sounds very cool but unfortunately, this didn't helped. A repo under the root works (e:\svn\some-proj) but repo under a sub-root - not: "Could not open the requested SVN filesystem" (e:\svn\some-dir\some-proj). Is there any other Apache conf trick to implement the task as you described?
abatishchev
I'm afraid each `<Location>` will be restricted to one root associated with the `SVNParentPath` if you are using an Apache server, I tried to get some hierarchy a while ago but didn't succeed unless using several locations (I'm no Apache guru though). That's why I switched to svnserve. My previous comment was about 2 locations, the first at the root and the second below, with the first one excluding the second in a regular expression, like `<Location /svn(?!/some-dir)>`, the second one being `<Location /svn/some-dir>`. Maybe Apache handles that automatically though, you'll have to check.
RedGlyph
A: 

Changing Apache config

<Location /svn>

to

<Location /svn/>

fixes the problem of 403 error on directory listing

abatishchev
By reading your other PR on ServerFault I realized where your error message was coming from, too bad you didn't put that here as well. You can simply use the `RedirectMatch ^(/svn)$ $1/` directive to avoid this problem it will automatically append a trailing slash after `http://<host>/svn` (see my modified example).
RedGlyph
+1  A: 

This is not a direct answer to your question, and it is always great to learn stuff from the ground up as you are doing it now, but seeing as you're on a Windows machine I thought I'd mention VisualSVN server. It's a point-and-click, very nice to configure wrapper to the SVN binaries that provides a web access of its own as well.

Pekka
Thanks! I tried it. Unfortunately it supports only one root for repositories. All folders under the root must already be a repositories. But I have a number sub-dirs (categories) and only there repositories and located
abatishchev