Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Open Source

Subversion and Linux: Setup and Use, Part 2


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


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.