快捷搜索:   nginx

Linux subversion 安装后的权限设置

我的目标是使得用户:chenwei,fengdongwei,zhouwei,luowei,liuxin
有不同的权限, 于是按照手册上配置, 出现了错误, 主要的问题出在
手册上的配置是对于一个目录下有多个资料库, 但是我的svn目录下只有一个资料库,
所以上有些不同
下面是几个非常好的文章
http://study.pay500.com/2/s24508.htm
http://man.chinaunix.net/linux/debian/debian_learning/ch09s14.html
另外debian.linuxsir.org 上的http://debian.linuxsir.org/main/?q=node/58
都是非常好的文章, 根据他们文章里面的配置, 下面是一个标准的配置文件
# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual.
# <Location URL> ... </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/repos
<Location /svn>
   # uncomment this to enable the repository
    DAV svn
   # set this to the path to your repository
    SVNParentPath /var/lib/svn
    SVNIndexXSLT "/svnindex.xsl"
   # The following allows for basic http authentication. Basic authentication
   # should not be considered secure for any particularly rigorous definition of
   # secure.
   # to create a passwd file
   # # rm -f /etc/apache2/dav_svn.passwd
   # # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon
   # New password:
   # Re-type new password:
   # Adding password for user dwhedon
   # #
   # Uncomment the following 3 lines to enable Basic Authentication
    AuthType Basic
    AuthName "Subversion Repository"
   # AuthLDAPEnabled on
   # AuthLDAPURL ldap://localhost/ou=Users,dc=sczfcpa,dc=com?uid?one
    AuthUserFile /etc/apache2/dav_svn.passwd
   # Uncomment the following line to enable Authz Authentication
    AuthzSVNAccessFile /etc/apache2/dav_svn.authz
   # Uncomment the following three lines allow anonymous read, but make
   # committers authenticate themselves
   # <LimitExcept GET PROPFIND OPTIONS REPORT>
     Require valid-user
   # </LimitExcept>
</Location>
另外需要写权限文件, 可以参考

[groups] #定义组
admin=jims,ringkee
tests=tester1,tester2

[erp:/] #定义erp储存库根目录的访问权限
@admin=rw #admin组有读写权限
tests=r #test用户只有读权限

[oa:/test] #定义oa储存库下test目录的访问权限
*= #禁止所有用户访问,星号代表所有用户,权限为空代表没有任何权限
ringkee=rw #打开ringkee用户的读写权限

注意,组用户的rw必须写成 @admin 前面有@
用户的rw没有@
另外, 由于是多个repo,所以权限文件里面的目录是上面那么写的,
: 前的代表了repo资料库的名称,
如果是单独的资料库, 那么就一定要没有: 和他前面的东西。

下面说我的一些经验, 我只有一个svn的repo~,所以配置不一样:
svn权限的
<Location /svn>
DAV svn
SVNPath G:\svn\repository
AuthType Basic
AuthName "Subversion repository"
AuthUserFile G:\svn\svn-auth-file

#AuthzSVNAccessFile G:\svn\accessfile
<LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
</LimitExcept>
</Location>
上面的代码可以实现验证用户的提交,但是没法做到按目录的管理
在accessfile里面
如果是多个respositor, 则写为[testmgr:/]这样的目录, 但是
如果上面用的SVNPath,只有一个res,那么必须写[/]这样的目录
而且 , 如果是rw权限的话, 必须使用@group=rw才可以
组用户是@admin=rw
用户是liuxin=rw
单个项目的话, 目录是这样的
[/testmgr/branches/]
以res的名称开头
郁闷!!

最后的配置文件是
[groups]
admin=root
leader=chenwei
dev=fengdongwei,zhouwei,luowei,liuxin

[/testmgr/branches/fengdongwei]
fengdongwei=rw
[/testmgr/branches/zhouwei]
zhouwei=rw
[/testmgr/branches/luowei]
luowei=rw
[/testmgr/branches/liuxin]
liuxin=rw

[/testmgr]
*=r
@admin=rw
@leader=rw


几个比较重要的命令是
svnadmin create d:\svn\repository     在那个目录下建立repository档案库,如果在这个目录D:\svn\下建立多个的话,就需要在上面的配置文件里面用SVNParentPath了,现在svn目录下只有一个repo,就只能用SVNPath

svn import . http://localhost/svn -m "Initial repository layout"    导入一个目录

顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论