SVN認證失敗的錯誤分析
阿新 • • 發佈:2018-12-19
作者:朱金燦
時常碰見SVN認證失敗的問題,經過一番思考,可以總結出錯誤根源是:在SVN的資料庫目錄下有一個svnserve.conf檔案,開啟這個檔案,裡面有這樣一行:
# authz-db = authz
如果把這行改為:
authz-db = authz
就意味著svn授權檔案為authz。預設授權檔案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# [/foo/bar]# harry = rw# &joe = r# * =# [repository:/baz/fuz]# @harry_and_sally = rw# * = r
既然你指定了一個授權檔案,就得對這個預設的授權檔案進行編輯。現在假設你的svn資料為doc,你的使用者名稱為bill,那個這個授權檔案就可以改為:
[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# 指定根目錄和使用者訪問許可權[doc:/]bill = rw* =
當然在[groups]欄位裡你也可以設定組,通過組來進行授權。