Subversion svnserve as a service on Windows, accessing a repository on a Novell network drive (whew)

One great advantage of Subverson's new back-end storage format, FSFS, is that you can now store your Subversion repository on a network drive instead of on locally attached storage. This is good for me, as my Subversion "server" is a creaky old machine whose hard drive might go at any minute (side note: those hard drive MTBF ratings always did sound a little fishy).

I wanted to run svnserve as a service on Windows XP, serving a repository located on a Novell network share. A couple of hours later, success. Here's how.

The official Subversion documentation describes how to set up svnserve as a Windows service. The documentation describes a number of caveats, especially concerning escaping double quotes.

In addition to those caveats, note these:

  • When mapping the root of the repository, don't use the drive letter. Specify the URN path instead. For example, use "\\someserver\SomeShare\My Repository" instead of "G:\My Repository"
  • Make sure the service is set to log on as an account that has permission to access the network share. (See screenshots below)

Step by step, here's what I did:

  1. Install Subversion 1.4
  2. Register svnserve.exe as a Windows service. Here is the command line. (To work, this code must be all on one long line.)
    sc create svn binpath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root \"\\YourServer\Data\Path To Your\Repository\"" displayname= "Subversion Server" depend= Tcpip start= auto

    Note that the trailing \  ( as in:  svnserve.exe\"    Your\Repository\" ) is there to escape the double-quote mark that follows it. Make sure to enclose your paths in escaped quotation marks if you have spaces in your paths.

  3. Open the Service manager (Start > Programs > Administrative Tools > Services). Double-click on the newly created "Subversion Server" service to show its properties.

    On the General tab, verify that the "Path to executable:" is correct
    General tab of Subversion Server Properties dialog

    On the LogOn tab, specify an account and password with access to the network share
    General tab of Subversion Server Properties dialog

Of course, running services as a domain user instead of as the LocalServices account goes against all the best advice about security. See this article from Microsoft for more info about running services securely.

Resources
Official Subversion book: Invoking svnserve
From CollabNet: Windows Service Support for svnserve
From Microsoft:
        Services permissions
        Microsoft Windows XP - Services permissions
        Services and Service Accounts Security Planning Guide
Scripts forum: Access mapped drive from a Windows Service

AttachmentSize
p1.jpg36.4 KB
p2.jpg37.63 KB