Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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>
share|improve this answer

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>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.