1

I've got SVN setup on my home server, I'm trying to get htaccess working so I can password protect the /var/www/html/svn/repos folder where all my code is kept.

The subversion.conf file looks like this:

<Location /repos>
   DAV svn
   SVNPath /var/www/html/svn/repos

   # Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL

      AuthType Basic
      AuthBasicProvider file
      AuthName "Subversion repos"
      # AuthUserFile /etc/svn-auth-conf
      AuthUserFile /home/myname/passwordfile
      Require valid-user
   </LimitExcept>
</Location>

The passwordfile file is in place and I've added a username and password. I've confirmed its working by placing a test folder in the html directory (/var/www/html/test/index.html), I've also added the .htaccess file, so when I turn on apache and try access http://IP_ADDRESS_OF_HOME_SERVER/test/index.html, I am prompted for a username and password.

For some reason I'm just not prompted for the username and password when trying to access http://IP_ADDRESS_OF_HOME_SERVER/repos/

Any help appreciated.

2 Answers 2

1

When you configure SVN access like this, the URL http://IP_ADRESS_OF_HOME_SERVER/repos/ points to a virtual folder. Because of this, the web server will not know where to look for the .htaccess file for this address.

You have included a LimitExcept in your config and this tells Apache to not ask for a valid username and password to simply view the repository.

Because of this, you must configure the access to the repository as you already have, with one exception, you do it for all requests, not just for writes. The .htaccess file is for the files hosted on your server and not used at all in this case, since SVN paths are virtual.

Your configuration should look something like this:

<Location /repos>
   DAV svn
   SVNPath /var/www/html/svn/repos

   # Require SSL connection for password protection.
   # SSLRequireSSL

   #Require all access to log in
   AuthType Basic
   AuthBasicProvider file
   AuthName "Subversion repos"
   # AuthUserFile /etc/svn-auth-conf
   AuthUserFile /home/myname/passwordfile
   Require valid-user
</Location>
0

Oyvind is on the right track, he only missed NameVirtualHost directive for letting SVN handle ip based request and ask for valid user.

Here is an example: (replace 127.0.0.1 with your ip, and 80 with your port)

NameVirtualHost 127.0.0.1:80
<VirtualHost your.svnhost.tld:80>
    ServerName your.svnhost.tld
    <Location /repos>
    DAV svn
    SVNPath /your/svn/path
    AuthType Basic
    AuthUserFile /your/svn-auth-file
    Require valid-user
    </Location>
</VirtualHost>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .