Svn 如何允许用户r/w访问某些子文件夹,但不允许访问父文件夹?

Svn 如何允许用户r/w访问某些子文件夹,但不允许访问父文件夹?,svn,permissions,apache2,Svn,Permissions,Apache2,我已经设置了一个由ApacheDAV和LDAP提供服务的SVN存储库。 当我使用对整个存储库具有读/写权限的用户访问respository时,一切都会顺利进行 存储库有许多项目,如下所示: repo_src \a \b \c \d .. etc.. [src_repo:/a] A = rw [src_repo:/] root = rw <Location /svn> DAV svn SVNParentPath /data/repos/ AuthName "Zenty

我已经设置了一个由ApacheDAV和LDAP提供服务的SVN存储库。 当我使用对整个存储库具有读/写权限的用户访问respository时,一切都会顺利进行

存储库有许多项目,如下所示:

repo_src
 \a
 \b
 \c
 \d
 .. etc..
[src_repo:/a]
A = rw

[src_repo:/]
root = rw
<Location /svn>
DAV svn

SVNParentPath /data/repos/
AuthName "Zentyal LDAP user required"
AuthType Basic
AuthBasicProvider ldap file
AuthBasicAuthoritative On
AuthzLDAPAuthoritative off

AuthLDAPURL ....
AuthLDAPBindDN ....
AuthLDAPBindPassword ...
AuthUserFile /dev/null
uthzSVNAccessFile /etc/apache2/svn.authz

require valid-user

</Location>
我需要让某个用户“a”访问某个子目录“a”,但不访问其父目录或其同级目录(b、c、d等)

我读了《颠覆版本控制》一书(http://svnbook.red-bean.com/en/1.6/svn-book.html#svn.serverconfig.pathbasedauthz)关于基于路径的授权。 我完全按照此处指定的方式进行了操作:我使用如下内容编辑了文件svn.authz:

repo_src
 \a
 \b
 \c
 \d
 .. etc..
[src_repo:/a]
A = rw

[src_repo:/]
root = rw
<Location /svn>
DAV svn

SVNParentPath /data/repos/
AuthName "Zentyal LDAP user required"
AuthType Basic
AuthBasicProvider ldap file
AuthBasicAuthoritative On
AuthzLDAPAuthoritative off

AuthLDAPURL ....
AuthLDAPBindDN ....
AuthLDAPBindPassword ...
AuthUserFile /dev/null
uthzSVNAccessFile /etc/apache2/svn.authz

require valid-user

</Location>
在Apache中,svn配置文件如下所示:

repo_src
 \a
 \b
 \c
 \d
 .. etc..
[src_repo:/a]
A = rw

[src_repo:/]
root = rw
<Location /svn>
DAV svn

SVNParentPath /data/repos/
AuthName "Zentyal LDAP user required"
AuthType Basic
AuthBasicProvider ldap file
AuthBasicAuthoritative On
AuthzLDAPAuthoritative off

AuthLDAPURL ....
AuthLDAPBindDN ....
AuthLDAPBindPassword ...
AuthUserFile /dev/null
uthzSVNAccessFile /etc/apache2/svn.authz

require valid-user

</Location>

DAV svn
SVNParentPath/data/repos/
AuthName“需要Zentyal LDAP用户”
AuthType Basic
AuthBasicProvider ldap文件
授权
authzldapoff
AuthLDAPURL。。。。
AuthLDAPBindDN。。。。
AuthLDAPBindPassword。。。
AuthUserFile/dev/null
uthzsvnacessfile/etc/apache2/svn.authz
需要有效用户
当我通过WEB界面(
http://host/svn/ src_repo/a
)作为用户a,我可以读取目录及其文件的内容。但是当我尝试浏览目录
http://host/svn/src_repo/a
使用陆龟vn或使用“svn checkout
http://host/svn/src_repo/a
“我收到这条信息:

svn:E175002:服务器发送了意外的返回值(405方法未发送) 允许)响应“/”的PROPFIND请求

显然,TortoiseSVN和svn客户端正在尝试访问“/”(这不是有意的)

如何将svn服务器设置为仅允许子目录访问?
为什么WEB访问不同于命令行或TotoiseSVN访问?

请重新阅读本书:您忽略并遗漏了authz文件规范中一些明显的内容

以my及其authz文件为例的简短回答

[/]
*=r

[Elgg-Russian:/]
@Coders=rw

[Elgg-TranslationRU:/]
@Translators=rw

[Hello:/]
lazybadger=rw

[Hello:/trunk]
lukoie=rw

[groups]
Coders=irrelevant,to,question
Translators=irrelevant,to,question
  • 我在单独的部分中定义了回购集合的根(作为根)
  • 我使用速记“任何用户”——*
  • 我不使用速记“无访问权”,但它作为空字符串存在:
    *=
    在任何部分都表示无访问权
  • 我有3个项目的3个存储库,而不是3个项目的1个共享回购,但即使在单个回购的情况下(由于SVNParentPath),我也将从/section开始

这似乎是svn客户端缓存的暂时问题。今天,同样的配置起了作用。我很想知道以前出了什么问题,但是没有办法确定。

是否需要阻止根目录上的读取访问?如果没有,您可以添加:[/]*=rSince read access是递归的,如果我添加root read access,则需要显式拒绝对“\a”以外的每个子目录的访问。这很容易出错,而且不符合最佳安全实践,因为添加的每个新项目都需要对svn.authz进行更改。