how to have login in WebSVN

Dave picture Dave · Aug 25, 2010 · Viewed 8.1k times · Source

Can some one tell me how to do I enable LOGIN function for WebSVN in Ubuntu 9.1?

I was tasked to create a SVN for my team, and the following is one of the link i followed which helped me successfully setup my first repos.

http://agilior.pt/blogs/pedro.rainho/archive/2010/02/06/11698.aspx

But after installing WebSVN, i can see my repos but no authentication was prompted.

The difference between my settings and the above mentioned website are in my httpd.conf (the website uses dav_svn.conf).

my httpd.conf content:

<Location /svn2>
    DAV svn
    SVNParentPath /home/svn2
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /etc/apache2/passwd
    AuthzSVNAccessFile /etc/apache2/dav_svn.authz
    Require valid-user
</Location>

my dav_svn.authz content:

[myproject:/]
    xxx = r

Many thks~ =)

Answer

Ken picture Ken · Sep 8, 2010

The easiest way is to set websvn to use the same auth file as you're already using for svn. This will depend on who your users are and whether you want the same permissions for the repository as the front-end, obviously. I do it this way so as to not have to mess with multiple auth files when we add/remove developers:

    <Directory /var/www/websvn/>
         AuthType SSPI
         SSPIAuth On
         SSPIAuthoritative On
         SSPIDomain "Subversion repository"
         SSPIOfferBasic On
         Require valid-user
    </Directory>

That trailing slash in the Directory directive has always been a sticking-point - you must include one. Now you'll need to edit your websvn config.php file to point websvn to your existing dav_svn.authz file:

$config->useAuthenticationFile("/etc/apache2/dav_svn.authz");

You can also use other auth providers if you'd rather use a database, active directory or separate auth file to govern access. Note that you will need to use the proper AuthType directive for that type of setup and you can omit the edit to config.php.