1. 程式人生 > >svn 配置多個倉庫和許可權控制

svn 配置多個倉庫和許可權控制

在前面的文章中,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 #其他只有讀許可權