Ramanathan Muthaiah is Configuration Management Lead at Infineon Technologies India. Ramanathan has more than 10 years of experience in customer support, network and systems administration, and configuration management, and can be reached at [email protected].
In Part 1 of this two-part article, I provided an overview of Subversion's design, showed how to set up the repository, access the respository via a "file://" scheme, and demonstrated steps for creating tags and branches. In this installment, I examine how you serve repositories via svnserve, http schemes, built-in properties (and their use), and merge functionality.
Recipes for Serving Repositories
Svnserve, bundled as part Subversion SVN default installation package, is a standalone daemon/server process capable of serving one or more repositories.
The following command starts svnserve as standalone daemon to serve all the repos located in /lnx_data/repos_holder. This way, future repos created in this folder can be served without having to start another instance of svnserve:
$/opt/svntest_1.4.3/bin/svnserve -d --listen-host=192.168.0.123 \ --listen-port=1131 -r /lnx_data/repos_holder/
By providing a direct path of a repository to the -r option (e.g., /opt/samagdocs), clients can access that repository only:
$/opt/svntest_1.4.3/bin/svnserve -d --listen-host=192.168.0.123 \ --listen-port 1230 -r /opt/samagdocs
Next, we check the host system, where these two processes are supposed to be running. The status is:
$ ps auxw | grep svnserve svnroot 31101 0.0 0.1 5340 632 ? Ss 01:09 0:00 /opt/svntest_1.4.3/bin/svnserve \ -d --listen-host=192.168.0.123 --listen-port=1131 -r /lnx_data/repos_holder/ svnroot 30827 0.0 0.1 5340 636 ? Ss 00:48 0:00 /opt/svntest_1.4.3/bin/svnserve \ -d --listen-host=192.168.0.123 --listen-port 1230 -r /opt/samagdocs
The objective of controlling access to the repository is via the parameters defined under specific sections in the file /path/to/repository/conf/svnserve.conf.
Here's sample output from one of the files of the repository for a previous example:
$ls /opt/samagdocs/conf/ authz passwd svnserve.conf
What are these files and why are they here?
- authz is used for path-based authorization to achieve fine-grained access control.
- passwd is the password file for svnserve; it's different from the system-level /etc/passwd.
- svnserve.conf is the main act; it has a simple structure to understand and maintain.
Here is a brief reference to the various parameters in svnserve.conf:
- anon-access = read allows read-only access to anonymous users.
- auth-access = write allows read-write access to authenticated users.
- realm = name is the name cooked up by the svn admin and displayed at the time of authentication.
As is obvious from the output below, the name of the realm is displayed by SVN client, along with the server's hostname and port:
$/opt/svntest_1.4.3/bin/svn commit -m "test file" README Authentication realm: <svn://192.168.0.123:1131> scratchpad Username: testid Password for 'testid': Adding README
- password-db = /path/to/password-file is the absolute/relative path to the file having list of entries for valid users and their password. The following shows the contents of a passwd file from one of the test repositories created in /lnx_data/repos_holder:
$cat /lnx_data/repos_holder/testrepo/conf/passwd ### 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 = harryssecret # sally = sallyssecret testid = svnallow123