svn 服务器用户权限设置,mac下配置svn服务器详解及用户的权限管理

本文详细介绍了在Mac上设置SVN服务器的步骤,包括创建repository、配置用户权限、编辑authz、passwd和svnserve.conf文件,以及启动服务器和导入、检查项目。还提及了CornerStone作为SVN客户端的使用方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先,感谢jsntghf和星辰的天空的好文分享,不是他们的文章,我估计须要花费更多的精力和时间。在这里我只是对他们文章的润色和本身测试遇到问题的标注。html

Mac自带了svn服务器和客户端,因此只须要简单配置一下就可使用apache

1. 建立svn repository服务器

Shell代码微信

svnadmin create /Users/mac22/svn/repository

svnadmin: E000002: Repository creation failed

svnadmin: E000002: Could not create top-level directory

svnadmin: E000002: Can't create directory '/Users/mac22/svn/repository': No such file or directory

注:mac22是当前登陆的用户名,你须要把它更换成你本身的用户名,在建立的时候确保已经svn/repository已经存在,上面的错误就是我没有建立svn/repository形成的网络

若是在终端输入svnadmin create /Users/mac22/svn/repository 代码,无提示说明建立成功,以下图所示:less

0db3ea422dd066c5c8dffcb7b52627ed.png

2. 配置svn用户权限/Users/mac22/svn/repository/conf/目录下存在3个文件: authz、passwd、snvserve.confide

你能够选择使用文本编辑打开,也可使用终端打开,我这里选择了后者svn

Shell 代码测试

martins-mac:conf mac22$ cd /Users/mac22/svn/repository/conf

martins-mac:conf mac22$ ls

authz   passwd  svnserve.conf

martins-mac:conf mac22$ vi authz

解释一下主要的几个命令:cd:进入某一个目录;ls:浏览当前目录的子目录 vi: 对文件进行编辑

authz 用户权限分配内容显示以下,而后按"i"键进行编辑:ui

### 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]

# admins是组名,admin是组员,能够写多个,用”,“分隔.如admins=admin,master

admins=admin

# harry_and_sally = harry,sally

# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]

# harry = rw

# &joe = r

# * =

# 设置/目录权限

[/]

# 这里的意思是admins组的成员都有rw的权限,rw是读写得权限,也能够写成admin=rw,只赋予某一个用户有读写权限

@admins=rw

# 这里若是不写的意思是,下一级目录的用户不具有继承关系,也就是没有访问/的权限,* = r,就是别>的用户只能远观了, * = rw,就让其余的用户也有继承关系了,就是也可具有读写权限

* =

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

~

编辑以后,切换到英文输入法,而后点击esc,接着输入:wq保存,若是输入有误能够输入:q不保存直接退出

在终端输入vi passwd编辑passwd,svn用户和密码内容以下:

### 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]

# authz 的用户名对应起来,后面是用户密码

admin=123456

# harry=harryssecret

# sally=sallyssecret

修改以后记得保存

在终端输入vi svnserve.conf编辑svnserve.conf,svn的配置信息内容以下:

### 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.apache.org/ for more information.

[general]

### The anon-access and auth-access options control access to the

### repository for unauthenticated (a.k.a. anonymous) users and

### authenticated users, respectively.

### Valid values are "write", "read", and "none".

### Setting the value to "none" prohibits both reading and writing;

### "read" allows read-only access, and "write" allows complete

### read/write access to the repository.

### The sample settings below are the defaults and specify that anonymous

### users have read-only access to the repository, while authenticated

### users have read and write access to the repository.

# anon-access=read匿名用户有读的权限

# 禁用匿名用户读的权限

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 file's location is relative to the directory containing

### this configuration file.

### If SASL is enabled (see below), this file will NOT be used.

### Uncomment the line below to use the default password file.

# 这里须要放开注释,关联passwd.

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 file's location is relative to the the

### directory containing this file.  If you don't specify an

### authz-db, no path-based access control is done.

### Uncomment the line below to use the default authorization file.

# 这里须要放开注释,关联authz

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

### is repository's uuid.

# realm=MyFirst Repository

### The force-username-case option causes svnserve to case-normalize

### usernames before comparing them against the authorization rules in the

### authz-db file configured above.  Valid values are "upper" (to upper-

### case the usernames), "lower" (to lowercase the usernames), and

### "none" (to compare usernames as-is without case conversion, which

### is the default behavior).

# force-username-case=none

[sasl]

### This option specifies whether you want to use the Cyrus SASL

### library for authentication. Default is false.

### This section will be ignored if svnserve is not built with Cyrus

### SASL support; to check, run 'svnserve --version' and look for a line

### reading 'Cyrus SASL authentication is available.'

# use-sasl=true

### These options specify the desired strength of the security layer

### that you want SASL to provide. 0 means no encryption, 1 means

### integrity-checking only, values larger than 1 are correlated

### to the effective key length for encryption (e.g. 128 means 128-bit

### encryption). The values below are the defaults.

# min-encryption=0

# max-encryption=256

3. 启动服务器

Shell 代码

martins-mac:conf mac22$ svnserve -d -r /Users/mac22/svn/repository/

martins-mac:conf mac22$ svnserve 启动svn服务;

-d 标示svnserve将会做为一个服务程序运行在后台 -r 标示将/Users/mac22/svn/repository/做为根目录(网络搜索的,忘求证)

4. 向svn库导入一个根目录

Shell代码

martins-mac:conf mac22$ svn import /Users/mac22/svnroot/ svn://localhost:3690/svnroot --username admin --password 123456 -m "Initial import"

Committed revision 1.

martins-mac:conf mac22$ 若是出现上面Committed revision 1.说明根目录建立成功

注:由于我以前已经建立了一个svn,因此这里为了区分用了一个端口3690,若是你以前没有建立过,就不须要用端口,直接svn://localhost/svnroot

5. 签出根目录

Shell代码

martins-mac:conf mac22$ cd /Users/mac22/svncheckout/

martins-mac:svncheckout mac22$ svn checkout svn://localhost/svnroot --username=admin --password=123456

Checked out revision 1.

martins-mac:svncheckout mac22$ 解释一下上面代码,先进入你须要签出的目录,而后执行签出,成功以后,会看到以下图所示:

830982555680f816d4049a113fbc9f68.png

6. 其余svn客户端链接

我我的推荐使用CornerStone,虽然界面不太漂亮,可是比较实用

1. 添加Repository

724af6fc01ca1d7aaeb30cc6576a09eb.png

2. 配置svn server

5db29daac0e8c78dc32ca77157bb8c75.png

3. 等待片刻,提示成功,显示一下界面

143cbb0586d336c18df348429a5ea07a.png

到这里要告一段落,下篇将把用户权限控制补上,若有不便请见谅。若是有建议和问题请回复,谢谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值