apache 如何为不同的写权限配置SVN web访问?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1948318/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:31:33  来源:igfitidea点击:

How to configure SVN web access for different write permissions?

apachesvnapache2

提问by abatishchev

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

我正在尝试在 Windows Server 2008 下的 Apache2 上为不同的写入权限配置 SVN Web 访问。

I have next Apache2 conf:

我有下一个 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:\SVNis a root directory for all repositories - I want to list the all. It contains E:\SVN\test- is a project repository.

E:\SVN是所有存储库的根目录 - 我想列出所有。它包含E:\SVN\test- 是一个项目存储库。

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

and E:\SVN\foobar- 是包含E:\SVN\foobar\fooE:\SVN\foobar\bar- 项目存储库的子根目录 。

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

文件svn-auth.txt包含由生成的多个用户密码htpasswd.exe

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

文件svn-acl.txt包含写访问规则,但它不起作用!事件它只包含一个全局权限:

[/]
* = rw

What is the different between SVNPathand SVNParentPathin Apache2 config for SVN? Maybe it would be make a sense?

SVN 的 Apache2 配置之间SVNPathSVNParentPath中的区别是什么?也许它会有意义?

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.

我得到403 Forbiden

What am I doing wrong? TIA!

我究竟做错了什么?蒂亚!

Update:I found a record from error.log:

更新:我从 error.log 中找到了一条记录:

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

What could it mean?

这意味着什么?

采纳答案by abatishchev

Changing Apache config

更改 Apache 配置

<Location /svn>

to

<Location /svn/>

fixes the problem of 403error on directory listing

修复403目录列表出错的问题

回答by RedGlyph

SVNPathis for one repository, SVNParentPathis 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://<host>/svn/foobar.

SVNPath用于一个存储库,SVNParentPath用于包含多个存储库的根目录。因此,您应该删除 Apache 配置文件中的第二个位置,因为如果您尝试访问http://<host>/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.

您应该为访问和身份验证文件放置绝对路径,确保 Apache 服务具有对父目录和所有存储库的读/写访问权限,以及对这些访问和身份验证文件的读访问权限,这在手动安装中经常被忽略。

For example:

例如:

<Location /svn>
    RedirectMatch ^(/svn)$ /
    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).

您将在带有 Subversion 的版本控制中找到所有必要的信息(这是指向最新版本的链接,尽管 Apache 配置设置最近没有更改)。

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.

在此示例中,您已在 中设置一般规则[/],然后将适用于foorbar(以及以下所有内容)的特定规则,以及otherproject。您甚至可以为存储库的各个目录指定特定规则。

回答by Pekka

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.

这不是对您问题的直接回答,并且像您现在所做的那样从头开始学习总是很棒的,但是看到您在 Windows 机器上,我想我会提到VisualSVN server。这是一个点击式操作,非常适合将包装器配置为 SVN 二进制文件,它也提供了自己的 Web 访问。