1、SVN搭建与权限配置文库SVN搭建与权限配置文库.txt根网线尽赚了多少人的青春有时候感动的就是身边微不足道的小事。破碎不是最残酷的 最残酷的是踩着这些碎片却假装不疼痛 固执的寻找将来就算我遇见再怎么完美的人,都有一个缺点,他不是你,_下辈子要做男生,娶一个像我这样的女生。SVN 版本管理工具笔记:一.配置笔记: :安装文件: 服务器软件: VisualSVN-Server-2.1.1.msi 客户端软件: TortoiseSVN-1.6.7.18415-win32-svn-1.6.9.msi 二.工具随笔: :Subversion 是一个梦幻般的锤子,但要小心不要把任何问题当作钉子。 :Su
2、bversion 有一个基本原则就是一个“推”动作不会导致“拉”,反之亦然,因为你准备好了提交你的修改并不意味着你已经准备好了从其他人那里接受修改。 如果你的新的修改还在进行,svnupdate将会优雅的合并版本库的修改到你的工作副本,而不会强迫将修改发布。这个规则的主要副作用就是,工作副本需要 记录额外的信息来追踪混合修订版本,并且也需要能容忍这种混合,当目录本身也是版本化的时候情况更加复杂。 : 三.本地目录笔记: : D:SVN_SERVER_FODLER SVN本地服务目录 : 四.创建版本库命令行记录: : svnadmin create D:SVN_SERVER_FODLER 创建
3、档案库 : D:SVN_SERVER_FODLERconf 目录下设置权限 D:SVN_SERVER_FODLERconfsvnserve.conf 设置存取权限 D:SVN_SERVER_FODLERconfpasswd 设置用户及密码 D:SVN_SERVER_FODLERconfauthz 设置用户组 及用户对应的目录权限 :启动SVN Service svnserve -d -r D:SVN_SERVER_FODLER 在windows下注册SubVersion 为系统服务(windows service): sc create Subversion binPath= C:Progra
4、m FilesSubversionbinsvnserve.exe -service -r D:SVN_SERVER_FODLER DisplayName= SubversionRichardY start= auto depend= TCPIP group权限设定: 我们会在目录结构中找到一个叫做conf的文件夹,打开这个文件夹,你会看到三个文件,分别叫做authz,passwd,svnserve.conf。下面我们就来介绍一下这三个文件的作用格式什么。首先,我们介绍passwd这个文件。用你习惯的文本编辑器打开这个文件,你会看到一些使用“#”注释掉的说明,其中关键的就是在users下面,有#
5、 harry = harryssecret# sally = sallyssecret样的样板代码,意思就是有两个用户,其中一个的用户名叫“harry”,密码为“harryssecret”,而另一个用户名为“sally”,密码为“sallyssecret”。我们接下来为我们的测试下面添加一些用户,这样方便我们下面的说明。比如,我要添加三个用户,一个叫做“nicholas”,密码为“nicholas”,第二个用户名为“friend”,密码为“friend”,第三个为“stranger”,密码为“strangers”。代码如下:nicholas = nicholasfriend = friend
6、stranger = stranger这样,我们就添加好了三个认证用户。# 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 = harrysse
7、cret# sally = sallyssecretnicholas = nicholasfriend = friendstranger = stranger 下面,我们来介绍authz这个文件,这个文件是控制权限的关键。同样打开这个文件,你会看到一些注释掉的语句,# groups# /foo/bar# repository:/baz/fuz 下面,我们介绍一下用户组的概念。所谓用户组,顾名思义,就是一个成员组,一般情况下,在同一个成员组的人员享有同样的权力,比如读,写权。Subversion为我们提供了一个很好的用户组应用。在之前,我们一共建立三个用户,nicholas,friend和str
8、anger,我们现在设想一下我们的组情况,假设我们希望nicholas和friend在开发组中,这两个用户具有读和写的权力,而用户stranger在测试组中,只具备读的权力。那么我们该如何来控制这个权限呢?看看下面的代码:我们先在groups标记下面,输入组的名称: dev_group = nicholas, friend test_group = stranger到目前为止,我们已经为三个用户分好了用户组,其中nicholas和friend在dev_group中,而stranger则在test_group中。下面,我们为两个组来分配权限。首先我们要为这两个组所能访问的工程做一个规定,正如在之
9、前的文章Eclipse中使用Subversion进行版本控制中,曾经向版本参考提交了一个名为“TestSVNProj”的项目,下面我就假设刚刚建立的两个用户组都需要最这个工程进行操作。我们在authz文件中,写下TestSVNProj,这个是指定我们下面将对TestSVNProj项目进行定义。我们使用如下代码:dev_group = rwtest_group = r这就定义了,对TestSVNProj项目,dev_group用户组可以进行读,写操作,而test_group用户组则只具备读的权限。为了阻止其他用户组对这个文件有读的权力,我们可以再添加一句:* =这个语句就是指定其他的用户组的权力
10、为空,也就是没有权力。# 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 auth
11、orization line can refer to a# single user, to a group of users defined in a special groups# section, or to anyone using the * wildcard. Each definition can# grant read (r) access, read-write (rw) access, or no access# (). groups# harry_and_sally = harry,sally dev_group = nicholas,friendtest_group =
12、 stranger # /foo/bar# harry = rw# * = # repository:/baz/fuz# harry_and_sally = rw# * = r /TestSVNProjdev_group = rwtest_group = r* = 最后,我们在来说说这个svnserve.conf文件,打开这个文件,我们就可以看出这个是Subversion权限配置的主文件,类似于读取相关信息的枢纽。为了让我们刚刚配置的两个文件(passwd和authz)起作用,我们需要去掉password-db = passwd和authz-db = authz前面的注释符“#”,让Subve
13、rsion知道要从上面两个文件中读取相关信息。当然,你也可以指定其他的认证文件,写法如下: password-db = .passwdauthz-db = .authz以此类推。 在实战过程中,处于安全的考虑,我们往往要限制对匿名用户的访问权限,所以我们可以将anon-access = read前面的“#”去掉,并将read参数修改为none,表明禁止匿名用户对版本控制库的访问。# This file controls the configuration of the svnserve daemon, if you# use it to allow access to this reposit
14、ory. (If you only allow# access through http: and/or file: URLs, then this file is# irrelevant.) # Visit http:/subversion.tigris.org/ for more information. general# These options control access to the repository for unauthenticated# and authenticated users. Valid values are write, read,# and none. T
15、he sample settings below are the defaults.anon-access = none# auth-access = write# The password-db option controls the location of the password# database file. Unless you specify a path starting with a /,# the files location is relative to the conf directory.# Uncomment the line below to use the def
16、ault password file.password-db = passwd# The authz-db option controls the location of the authorization# rules for path-based access control. Unless you specify a path# starting with a /, the files location is relative to the conf# directory. If you dont specify an authz-db, no path-based access# co
17、ntrol is done.# Uncomment the line below to use the default authorization file.authz-db = authz# This option specifies the authentication realm of the repository.# If two repositories have the same authentication realm, they should# have the same password database, and vice versa. The default realm#
18、 is repositorys uuid.# realm = My First Repository 至此,你可以控制你的项目,对其进行访问权限的控制了。 下面是我写的所有关于Subversion的文章,希望对大家有用,文章是按照内容的先后难度顺序排列,方便大家参考。 Subversion 记忆手册http:/shjy-Subversion详细说明http:/shjy-Subclipse使用手册http:/shjy-Eclipse中使用Subversion进行版本控制http:/shjy-我们会在目录结构中找到一个叫做conf的文件夹,打开这个文件夹,你会看到三个文件,分别叫做authz,pa
19、sswd,svnserve.conf。下面我们就来介绍一下这三个文件的作用格式什么。首先,我们介绍passwd这个文件。用你习惯的文本编辑器打开这个文件,你会看到一些使用“#”注释掉的说明,其中关键的就是在users下面,有# harry = harryssecret# sally = sallyssecret样的样板代码,意思就是有两个用户,其中一个的用户名叫“harry”,密码为“harryssecret”,而另一个用户名为“sally”,密码为“sallyssecret”。我们接下来为我们的测试下面添加一些用户,这样方便我们下面的说明。比如,我要添加三个用户,一个叫做“nicholas”
20、,密码为“nicholas”,第二个用户名为“friend”,密码为“friend”,第三个为“stranger”,密码为“strangers”。代码如下:nicholas = nicholasfriend = friend stranger = stranger这样,我们就添加好了三个认证用户。# 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 s
21、ection labelled users.# The name and password for each user follow, one account per line. users# harry = harryssecret# sally = sallyssecretnicholas = nicholasfriend = friendstranger = stranger 下面,我们来介绍authz这个文件,这个文件是控制权限的关键。同样打开这个文件,你会看到一些注释掉的语句,# groups# /foo/bar# repository:/baz/fuz 下面,我们介绍一下用户组的概
22、念。所谓用户组,顾名思义,就是一个成员组,一般情况下,在同一个成员组的人员享有同样的权力,比如读,写权。Subversion为我们提供了一个很好的用户组应用。在之前,我们一共建立三个用户,nicholas,friend和stranger,我们现在设想一下我们的组情况,假设我们希望nicholas和friend在开发组中,这两个用户具有读和写的权力,而用户stranger在测试组中,只具备读的权力。那么我们该如何来控制这个权限呢?看看下面的代码:我们先在groups标记下面,输入组的名称: dev_group = nicholas, friend test_group = stranger到目前
23、为止,我们已经为三个用户分好了用户组,其中nicholas和friend在dev_group中,而stranger则在test_group中。下面,我们为两个组来分配权限。首先我们要为这两个组所能访问的工程做一个规定,正如在之前的文章Eclipse中使用Subversion进行版本控制中,曾经向版本参考提交了一个名为“TestSVNProj”的项目,下面我就假设刚刚建立的两个用户组都需要最这个工程进行操作。我们在authz文件中,写下TestSVNProj,这个是指定我们下面将对TestSVNProj项目进行定义。我们使用如下代码:dev_group = rwtest_group = r这就定
24、义了,对TestSVNProj项目,dev_group用户组可以进行读,写操作,而test_group用户组则只具备读的权限。为了阻止其他用户组对这个文件有读的权力,我们可以再添加一句:* =这个语句就是指定其他的用户组的权力为空,也就是没有权力。# 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 authoriz
25、ations 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 special groups# section, or to anyone using the * wildcard. Each definition can# grant read (r) access, read-w
26、rite (rw) access, or no access# (). groups# harry_and_sally = harry,sally dev_group = nicholas,friendtest_group = stranger # /foo/bar# harry = rw# * = # repository:/baz/fuz# harry_and_sally = rw# * = r /TestSVNProjdev_group = rwtest_group = r* = 最后,我们在来说说这个svnserve.conf文件,打开这个文件,我们就可以看出这个是Subversion
27、权限配置的主文件,类似于读取相关信息的枢纽。为了让我们刚刚配置的两个文件(passwd和authz)起作用,我们需要去掉password-db = passwd和authz-db = authz前面的注释符“#”,让Subversion知道要从上面两个文件中读取相关信息。当然,你也可以指定其他的认证文件,写法如下: password-db = .passwdauthz-db = .authz以此类推。 在实战过程中,处于安全的考虑,我们往往要限制对匿名用户的访问权限,所以我们可以将anon-access = read前面的“#”去掉,并将read参数修改为none,表明禁止匿名用户对版本控制库
28、的访问。# 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.) # Visit http:/subversion.tigris.org/ for more information. general# These options control
29、access to the repository for unauthenticated# and authenticated users. Valid values are write, read,# and none. The sample settings below are the defaults.anon-access = none# auth-access = write# The password-db option controls the location of the password# database file. Unless you specify a path starting with a /,# the files location is relative to the conf directory.# Uncomment the line below to use the default password file.password-db = passwd# The authz-db option controls the location of the authorization# rules for path-based access control. Unless you specify a path# startin
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1