Configure Subversion to Login in Using System Users

By Petr Kout, March 11, 2012

Configure Subversion to Login in Using System Users
        There is a plethora of articles about how to install subversion in a Linux system, but absolute majority of them guides one to use the internal Subversion user authentication system. I find it annoying to have to create a system user and a separate Subversion user for each of my system users, so I decided to configure my Subversion such that it authenticates users against the system user database instead of its own user/password database. In this tutorial, I will show you how to do it in a few simple steps.

These work on Linux Ubuntu, but they should be very similar on other distros as well.

First of all, follow one of the plethora of articles online that will guide you through the process of installing Subversion if you don’t have one installed yet (feel welcome to skip the sections on setting up a password file – we will override it). Once you’re done with that, follow the steps below:

  • The first thing you’ll need to do is to install pwauth as an Apache 2 module:

    sudo apt-get install libapache2-mod-authnz-external pwauth
  • Then enable the installed pwauth module:

    sudo a2enmod authnz_external
  • Then go to your apache2.conf file and open it (in my case, the file is located at /etc/apache2/apache2.conf) and add the following at the end of it.

    # External authentication method for Subversion
    AddExternalAuth pwauth /usr/sbin/pwauth
    SetExternalAuthMethod pwauth pipe

    Save the file, exit. Check the path to your pwauth and set the path correspondingly in the configuration file. It might be different on your system than on mine. You can check by issuing the command: which pwauth.

  • If you don’t have DAV enabled in your Apache 2, enable it now by running:

    a2enmod dav_fs
    a2enmod dav
  • Then edit the file /etc/apache2/mods-available/dav_svn.conf and set the pwauth provider as the authentication method of choice:

    AuthType Basic
    AuthName "Subversion Repository"
    AuthBasicProvider external
    AuthExternal pwauth
    Require valid-user
  • Restart the Apache server and you should be set.

    sudo service apache2 restart

    Now you can log into Subversion with your system user names.