WebSVN - Authentication for paths in the repository

volvox picture volvox · Nov 25, 2010 · Viewed 9.1k times · Source

I need simple 'to-the-point' tutorial or neat exemple of How to implement authorization for paths (checkout diretories) out of a single Subversion repository, using WebSVN.

Lets say repository is /svn/repos/r_project Two checkout (paths) from this repos are /svn/repos/path1 and /svn/repos/path2 ... I want to protect each path (directory) with a different username/password.

Subversion and WebSVN are installed on Unix Apache (redhat). Already i can see the two paths in the WebSVN repository front page - without any protection this is working fine.

I know how to protect individual web index page with .htpasswd but anything i have tried to protect individual paths in the repository through WebSVN page has failed.

Tx

[EDIT nov26]

Up to date situation to make it clear: Paths i have:

Home path in unix: '/var/www/'
Path of WebSVN: '/var/www/websvn2'
Path to repository: '/svn/repos'
Created repository is '/svn/repos/r_project') // so r_project is the repository name 
Two checkout directories of that repository:'/svn/repos/path1' and '/svn/repos/path2'

In httpd.conf i have locations for SVN and WEBSVN (i do have the necessary modules):

<Location /repos>
  DAV svn
  SVNParentPath /var/www/svn/repos
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile /etc/svn-auth-file
  Require valid-user
</Location>

<Location /websvn210/>
    Options FollowSymLinks
    AuthType Basic
    AuthName "Subversion Repository"
    Require valid-user
    AuthUserFile /etc/svn-auth-file
</Location>

For now, 'svn-auth-file' contains password for one user name. Put in '/etc' directory.

In config.php file of WebSVN i have:

$config->parentPath("/var/www/svn/repos");  
$config->useAuthenticationFile('/etc/svn-auth-file'); // Global access file

I'm able to see checkout directories 'path1' and 'path2' as regular index page with files in the browser (ex: 'http://mydomain/svn/repos/path1'). However, when i go for 'http://mydomain/websvn210' in the browser i only get the login (ok) than an empty home page of WebSVN - that is, no repository or checkout paths!

That's first problem: empty page. Second, will be to have different login for each path. Note: those paths (checkouts) are only for reading or downloading (no commit done from Subversion).

THanks.

Answer

zellus picture zellus · Nov 25, 2010

You might be looking for 'authz'. This is one of the many tutorials available.

EDIT
I think you're mixing two things together which do not belong together. One way to access a subversion repository is via WebDAV, this seems to be working. WebSVN on the other hand is for repository browsing. You won't be able to commit changes to your WebSVN URL.

Your 'SVNParentPath' should point to the repository and not to the WebSVN directory.

SVNParentPath /svn/repos