提问的智慧SVN版 - 提问者必读
返回列表 回复 发帖

[原创] 说说subversion服务器两种配置方式所用的配置文件及格式

目前subversion服务器可以用两种方式架设,
一种是基于svnserve,svnserve作为服务端;
一种是基于Apache,用apache作为服务端。

下面说说这两种方式所用的配置文件。

基于svnserve
配置文件位于版本库的conf下,有三个可以使用。
1、svnserve.conf

  1. ### This file controls the configuration of the svnserve daemon, if you
  2. ### use it to allow access to this repository.  (If you only allow
  3. ### access through http: and/or file: URLs, then this file is
  4. ### irrelevant.)
  5. ### Visit [url]http://subversion.tigris.org/[/url] for more information.
  6. [general]
  7. ### These options control access to the repository for unauthenticated
  8. ### and authenticated users.  Valid values are "write", "read",
  9. ### and "none".  The sample settings below are the defaults.
  10. anon-access = none
  11. auth-access = write
  12. ### The password-db option controls the location of the password
  13. ### database file.  Unless you specify a path starting with a /,
  14. ### the file's location is relative to the conf directory.
  15. ### Uncomment the line below to use the default password file.
  16. password-db = passwd
  17. ### The authz-db option controls the location of the authorization
  18. ### rules for path-based access control.  Unless you specify a path
  19. ### starting with a /, the file's location is relative to the conf
  20. ### directory.  If you don't specify an authz-db, no path-based access
  21. ### control is done.
  22. ### Uncomment the line below to use the default authorization file.
  23. authz-db = authz
  24. ### This option specifies the authentication realm of the repository.
  25. ### If two repositories have the same authentication realm, they should
  26. ### have the same password database, and vice versa.  The default realm
  27. ### is repository's uuid.
  28. # realm = My First Repository
复制代码
2、passwd (svnserve.conf中指明的password-db文件)
不同于基于apache的,此文件中的密码为明文

  1. ### This file is an example password file for svnserve.
  2. ### Its format is similar to that of svnserve.conf. As shown in the
  3. ### example below it contains one section labelled [users].
  4. ### The name and password for each user follow, one account per line.
  5. [users]
  6. # harry = harryssecret
  7. # sally = sallyssecret
复制代码
3、authz (svnserve.conf中指明的authz-db文件)
此文件的写法有单库多库的区别,详情见http://www.iusesvn.com/bbs/thread-157-1-1.html

  1. ### This file is an example authorization file for svnserve.
  2. ### Its format is identical to that of mod_authz_svn authorization
  3. ### files.
  4. ### As shown below each section defines authorizations for the path and
  5. ### (optional) repository specified by the section name.
  6. ### The authorizations follow. An authorization line can refer to a
  7. ### single user, to a group of users defined in a special [groups]
  8. ### section, or to anyone using the '*' wildcard.  Each definition can
  9. ### grant read ('r') access, read-write ('rw') access, or no access
  10. ### ('').
  11. [groups]
  12. # harry_and_sally = harry,sally
  13. # [/foo/bar]
  14. # harry = rw
  15. # * =
  16. # [repository:/baz/fuz]
  17. # @harry_and_sally = rw
  18. # * = r
复制代码
基于Apache
配置文件可以在httpd.conf中指定,如

<Location /svn>
DAV svn
#SVNListParentPath on
SVNParentPath e:\svnreps
AuthType Basic
AuthName "Subversion"
AuthUserFile e:\svnreps\passwd
AuthzSVNAccessFile e:\svnreps\authz
Require valid-user
</Location>

1、passwd (Location段中AuthUserFile指定)
此文件由Apache的bin目录下htpasswd程序创建,密码为密文

  1. try1:$apr1$j04.....$k4XHO0EUJCuG2A5IveRYF1
  2. try2:$apr1$jR0.....$57ZHP2MRRAXQu4Dw.Rv.a1
复制代码
2、authz (Location段中AuthzSVNAccessFile指定)
此文件格式跟基于svnserve方式的相同,同样也有单库多库区别,见http://www.iusesvn.com/bbs/thread-158-1-1.html

[总结]
从上面可以看出两种配置的区别,基于svnserve的配置文件一般均在conf目录下,目前还不能用绝对路径指定为其它目录,除非用相对路径;而基于Apache的,配置文件由httpd.conf的Location段中指定,可以在任意位置。另外,两种用户密码文件的格式是不一样的,一种明文,一种密文。

  • 提问前先用多种搜索方式、多种可能的关键字对论坛进行搜索
  • 提问时详细描述软件版本,自己要做什么,做了什么,遇到了什么
  • 最后的绝招:PM版主
  • 问题解决后,请自行将“求助”修改为“已解决”
明白了,,谢谢
很清晰...谢谢
说得很详细,谢谢
返回列表
订阅 我用Subversion - SVN中文论坛 邮件列表:iUseSVN@googlegroups.com
电子邮件:
网站重要事项将会在这个列表进行通知,点击这里浏览存于列表中的所有邮件