0516 svn authz 认证

一个朋友留言:
留言者 郑新星&thita;&thita;zhengxinxing <at> gmail <dot> com 留言时间 2006年5月12日14:49
留言内容
你好,你是否在windows下安装svn服务器?
我在windows下安装的,但是关于 authz 文件的配置,始终不行。
比如说我目录如下:
D:\\sub\\repos\\
—–myproject/
—————sub_project1\\

—————sub_project2\\

现在我想要让a只能访问 D:\\sub\\repos\\sub_project1\\ 目录下的文件,在authz里面该怎么配置呢?

谢谢

上网闲逛,不小心逛到你这儿(http://www.yippeesoft.com/blog/p/0516svnauthz.php)
你说的这个问题,现在已经有了解答了,有兴趣的话,不妨看看这个地址: http://iusesvn.com/bbs/thread-6-1-1.html  Subversion之路--实现精细的目录访问权限控制(v1.0 更新于2006.12.05)

我看了看那几个文件:
### 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.

### This file controls the configuration of the svnserve daemon, if you### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is### irrelevant.)

### 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, to a group of users defined in a specil [groups]
### section, or to anyone using the \’*\’ wildcard.  Each definition can### grant read (\’r\’) access, read-write (\’rw\’) access, or no access### (\’\').

也就是说:svnserve.conf 只能用在SVN:// 这种模式下面
而 用AUTHZ文件必须结合APACHE使用

例子:
Repository存放在D:\\repository下,有两个repository: test and xtest
每个repostory 的结构相同:
       根:01.txt
              02.txt
       folder 1-: 11.txt
       12.txt
folder 2-: 21.txt
   22.txt
对目录1和2作不同的读写权限控制
Basic Authentication
修改文件:
Httpd.conf:
#Basic authentication
<Location /repository>
              DAV svn
              SVNParentPath d:/repository
              AuthzSVNAccessFile d:/repository/accessfile                
              Require valid-user
              AuthType Basic
              AuthName "身份验证"
              AuthUserFile d:/repository/passwd                 
</Location>
用Apache的htpasswd生成用户名和密码,
Htpasswd –c passwd username
第二次不用 –c。
生成的用户名和密码在passwd中:
0:$apr1$Vu5…..$XZ/csz/2YKoPNKpb88O5p0
1:$apr1$vu5…..$I1VwMJ7JtRmpmJjVUlT4h1
2:$apr1$Dv5…..$vf2MTg/p0mY.WcFhx7wET1
3:$apr1$Tv5…..$gfk4AiP49h0JjKN8BuJdB.
AuthzSVNAccessFile控制每个目录的读写权限
[test:/]
1 = r
2 = r
3 = r
[test:/1]
1 = rw
[test:/2]
2 = rw

另外一个资料
3、设置项目的用户信息
Subversion项目conf目录下passwd文件,修改用户和密码,如[users]ems = mypassword
接下来是设置项目的一些其他信息,打开conf目录下的svnserve.conf文件,去掉相应项目前的"#",对匿名和授权访问、密码数据库、授权数据库进行设置,(注意,1、每个[secton]标签,如svnserve.conf中的[general]都必须从每行的第一列开始,否则会提示"Section
header must start in the first column" 2、每一项设置,如[general]下的password-db = password也必须从该行的第一列开始,否则会提示"Option expected",感觉有点莫名其妙:))

我经常服务启动失败,导致连接LOCALHOST失败~~
SVNService process ended prematurely: ("E:\\share\\Svn\\bin\\svnserve.exe" "-d" "D:\\SvnRoot")

历史博文

标签:,
十月 29, 2006 at 10:00 下午 by yippee 1,044 次
Category: Dev
Tags: ,