Ubuntu下 apache + svn 配置初探(完善中,仅供参考)

新建SVN代码库和用户


参考

Ubuntu SubVersion

Ubuntu下SVN+Apache版本管理服务器配置

Ubuntu 9.04 Server Apache + SVN 的搭建笔记

Version Control with Subversion

(待完善)



Apache配置

示例:/etc/apache2/mods-available/dav_svn.conf 

若个以下条目,对应一个或多个SVN代码库

<Location /DemoFolder/DemoSVNProject>


  # Uncomment this to enable the repository
  DAV svn


  # Set this to the path to your repository
  SVNPath /usr/local/svn_repository/DemoFolder/DemoSVNProject
  # Alternatively, use SVNParentPath if you have multiple repositories under
  # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
  # You need either SVNPath and SVNParentPath, but not both.
  #SVNParentPath /usr/local/svn_repository /DemoFolder/


  # Access control is done at 3 levels: (1) Apache authentication, via
  # any of several methods.  A "Basic Auth" section is commented out
  # below.  (2) Apache <Limit> and <LimitExcept>, also commented out
  # below.  (3) mod_authz_svn is a svn-specific authorization module
  # which offers fine-grained read/write access control for paths
  # within a repository.  (The first two layers are coarse-grained; you
  # can only enable/disable access to an entire repository.)  Note that
  # mod_authz_svn is noticeably slower than the other two layers, so if
  # you don't need the fine-grained control, don't configure it.


  # Basic Authentication is repository-wide.  It is not secure unless
  # you are using https.  See the 'htpasswd' command to create and
  # manage the password file - and the documentation for the
  # 'auth_basic' and 'authn_file' modules, which you will need for this
  # (enable them with 'a2enmod').

  #密码配置文件
  AuthType Basic
  AuthName "Repository"
  AuthUserFile /etc/subversion/passwd


  # To enable authorization via mod_authz_svn

  #配置对应的SVN鉴权文件,位于SVN代码库目录下
  AuthzSVNAccessFile /usr/local/svn_repository/DemoFolder/DemoSVNProject/conf/authz


  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.  It requires the 'authz_user'
  # module (enable it with 'a2enmod').
  #<LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  #</LimitExcept> 


</Location>


SVN鉴权文件

示例:/usr/local/svn_repository/DemoFolder/DemoSVNProject/conf/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]
# usr1_and_user2 = user1,user2
# usr1_user2_and_joe =usr1,user2,&joe
develop_app = app_user3,app_user4
develop_sys = sys_user3,sys_user3


# [/foo/bar]

# user 1拥有rw权限,别名joe拥有r权限,其他用户无权限
# user1 = rw 
# &joe = r
# * =


# [repository:/baz/fuz]
# user 2拥有rw权限,其他用户拥有r权限
# @usr1_and_user2 = rw
# * = r

#自定义的权限
[DemoSVNProject:/]
@develop_app = rw
@develop_sys = rw
[DemoSVNProject:/trunk]
@develop_app = rw
@develop_sys = rw
[DemoSVNProject:/branches/branch_demo/]
@develop_app = rw
@develop_sys = rw

##指定用户权限时不需加前缀,指定别名权限时别名前加&,指定组权限时组名前加@

##对子目录的操作权限自动继承自父目录。

[Demo1:/]
simba = rw
neptune = r
gooo = r
* = 
[Demo1:/dd]
cs = rw
gooo =         #取消gooo对Demo1/dd目录的访问权限。若不加此行,gooo可访问Demo1/dd目录,他继承自其父目录。
[Demo1:/dd/d2]
gooo = rw    #使得gooo可访问Demo1/dd/d2,即使gooo不能访问Demo1/dd
cs = rw

你可能感兴趣的:(Ubuntu下 apache + svn 配置初探(完善中,仅供参考))