Use and permissions configuration of SVN server under Linux

Source: Internet
Author: User

First, install SVN

Under Linux, you can get SVN server directly from the following command: (I use the server system for Debian 7.5 stable version)

apt-get Install Subversion

After the installation is complete, you can view the installed version through Svnserve--version, I am using the SVN server version 1.6.17:

Ii. Creating a code base

To create a library (take the test library as an example):

sudo svnadmin create/home/user/svn/test

In this way, a simple code repository is created.

Next start the SVN service:

Svnserve-d-r/home/user/svn/test

The client will then be able to access SVN through "svn://ip.ip.ip.ip/test".

Third, permission configuration

After entering the test directory, you will see a "conf" folder inside, into the Conf folder, ls a bit, you will see three files Authz, passwd, Svnserve.conf three configuration files, where Authz is used to configure user access, passwd is used to configure the user and password, SVNSERVE.CONF is configured for the entire svnserve process.

Use Nano or VI tool to open svnserve.conf, find "# password-db = passwd", this sentence is to specify the current library of the corresponding user profile, we need to the front of the "#" and the space to delete;

Found "# anon-access = none"

"# auth-access = write" These two sentences, the first sentence is used to control anonymous access, we directly set it to none is good, the second sentence to control the access to the library through the authentication permission of the user, here we set into write can, of course, also to the front of the "#" and spaces are deleted;

Find "# authz-db = Authz", this sentence is used to specify the current library corresponding to the user rights profile, we put the front of the "#" and the space is deleted, so that the library at run time according to authz this configuration file to match user rights.

Here, all of our profiles can play their part, followed by a detailed configuration of the details:

For passwd:

Very simple, in the end directly add the user is good, the format is: "User name = password", for example: "Test_user = 12345"

For Authz:

This is mainly divided into two types of configurations: [Groups] class configuration, configuration beginning with [repo:/].

1.[groups] Configuration is easy to understand, is the group. The format is also relatively simple, that is, "group_name = User1,user2,user3", if there are multiple users, you can directly through the "," the way splicing can be, for example:

[Groups]

    #  manager  
    G_MANAGER = MICHAEL  
    #  Beijing office personnel  
    G_BEIJING = SCOFIELD  
    #  Shanghai office personnel  
    G_SHANGHAI = LINCON  
    #  headquarters General Staff  
    g_headquarters = rory, linda  

2. Start with [repo:/] configuration, the top of the [Gourps] configuration is used to divide the user group, then the [repo:/] configuration is used to specifically divide the user read and write permissions, where repo is the name of your library, that is, the top we passed "Svnadmin Create/home/user/svn/test "command to create the library" test ", below we directly use examples to illustrate how it is used:

Limit the project root directory to allow only managers to modify, and others to have read permissions only:
[test:/]
@g_manager = RW

* = R
"[test:/]" indicates the relative root node of the directory structure, or the root directory of the test project. The "@" here means that the next is a group name, not a user name. Since there is only one Michael in the G_manager group, you can of course replace the line "@g_manager = RW" with "Michael = RW", which is exactly the same as the meaning of the expression.
"*" means "everyone except those mentioned above", which is "everybody except the department manager."
"* = r" means "those who can only read, cannot write."

For subdirectories under the root directory, their permissions are configured the same way, it is necessary to specify the address, that is, [Test:/folder1/folder2], here is not to repeat.

Note: In the configuration we may encounter "* =" situations where his purpose is to partition the inheritance of permissions. If this sentence is added to the permission configuration of a level of directory, it indicates that users other than the users in the configuration do not have any rights to this level of directory at all, neither readable nor writable.

When all three files are fully configured, the next step is to make them work, first we need to make sure that the Svnserve service has been stopped, and can be viewed in "PS aux|grep svn" way to see if SVN is still running, if it is still running directly through the "kill-9 [ SVN process number] "way to stop it, and then in the command" svnserve-d-r/home/user/svn/"to restart the SVN service, the above configuration of the three files will be working!

Related references:

Install SVN on Debian 7:

Http://www.cnblogs.com/xusir/p/3326142.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.