您的位置:首页 > 其它

svn 配置多个仓库和权限控制

2017-02-27 20:24 387 查看
在前面的文章中,Shop是一个仓库,如果同时开发多个项目,就要建立多个仓库,同时进行多个项目监管

svnserve只可以监管一个文件夹,不可以监管多个仓库。

可以通过监管总目录来达到监管所有仓库的目的

比如Shop仓库的总目录是 WebApp

切换到WebApp目录,执行

svnserve -d -r ./即可

这样我们就可以通过svn://localhost访问WebApp了

如果要访问Shop目录,就是svn://localhost/Shop

但是如果更改了localhost的指向,那么之前靠这个指向的检出目录就会无法连接了

权限控制

仓库资源文件下

conf文件夹里面

authz文件 授权文件 告诉那些用户具有那些权限

passwd文件 认证文件 标志某个仓库具有那些用户和相应的密码

svnserve.con 核心配置文件

anon-access = write

auth-access = write

第一个是匿名权限

第二个是认证权限

password-db = passwd

authz-db = authz

去掉注释

,这样就开启了授权文件和认证文件

接着编写认证文件passwd,定义相关用户名和密码

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
#定义用户admin和huang密码分别是admin和1995
admin = admin
huang = 1995


然后编辑authz文件

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
#组名=用户名
admin = admin
kaifa = huang,admin

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[Shop:/]
@admin = rw  #admin组有读写权限
@check = r   #check组有读权限
* = r        #其他只有读权限
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: