SVN server installation under Debian

1. Install

# apt-get update

# apt-get install subversion subversion-tools

2. Create repository

# mkdir /opt/svn

# svnadmin create –-fs-type fsfs /opt/svn/test

3. Setting permissions

# chown –R www-data:www-data /opt/svn/*

# chmod –R 770 /opt/svn/*

4. Start the svnserve service

#svnserve -d /opt/svn/xx

5. Configure permissions: authz file

 

Instruction introduction: This configuration file adopts the "path-based authorization" policy, the path is specified in square brackets, and the authorization for each user is listed below. Including read-only r, read-write rw. No user listed, access is not allowed. You can also group users. For details, please refer to the svn manual. The following is a simple example:

 

<!--[if !supportLineBreakNewLine]--> User group format:

[groups]

<user group name> = <user1>,<user2>

Among them, a user group can contain one or more users, and the users are separated by commas.

 

Repository directory format:

[<Repository>:/Project/Directory]

@<user group name> = <permission>

<username> = <permissions>

Among them, the inner part of the box number can be written in multiple ways:

/, represents the root directory and below. The root directory is specified when svnserve starts, we specify /opt/svndata. In this way, / means to set permissions on all repositories.

repos1:/, which means setting permissions on repository 1

repos2:/abc, , indicates setting permissions on the abc project in repository 2

repos2:/abc/aaa, , indicates setting permissions on the aaa directory of the abc project in repository 2

The authority subject can be a user group, user or *. The user group is preceded by @, and * means all users. Permissions can be w, r, wr and null, null means no permissions.

 

========= Modify Configuration File ===========

/opt/svn/test/conf/svnserve.conf:

[general]

anon-access = read

auth-access = write

password-db = passwd

authz-db = authz

realm = /opt/svn/test # Authentication namespace, which subversion will show in the authentication prompt and used as a key to the credential cache.

 

/opt/svn/test/conf/passwd:

[users]

tone = tone

/opt/svn/test/conf/authz:

[groups]

project_1 = tom

 

[prj1: /]

@project_1 = rw

 

access

svn://192.168.1.105/prj1

Authentication fails

 

The reason is:

When svn://192.168.1.105/prj1 is accessed, the library corresponding to tom cannot be found, because [prj1:/] is not a valid library path

Change [prj1:/] to [/], and [/] represents all resources in the root directory. If you want to limit resources, you can add subdirectories.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326663307&siteId=291194637