1

I am trying to add a new user to authenticate to Apache2 (httpd) through Active Directory. The user already exists and belongs to a domain.

I am essentially following the instructions in this Apache and Subversion authentication with Microsoft Active Directory article .

However, when I type:

htpasswd C:\Apache2\conf\auth\svn_auth_file newuser1

I get prompted for the new password (and its re-type), then I get the message:

Adding password for user newuser1
htpasswd: unable to update file C:\Apache2\conf\auth\svn_auth_file

What could possibly prevent that file from updating?

What am I doing wrong?

1 Answer 1

3

If the svn_auth_file doesn't already exist, you probably need the "-c" option on the htpasswd command for the first user (and only the first user). Note that this will truncate the file if it already did exist, so check first to make sure you're not obliterating an existing file.

Also, on Windows you need to run this as Administrator (it is not enough that you run this as a standard user, even if that user belongs to the Administrators group).

3
  • Thank you for this tip +1. I have already verified that the file exists. Is it possible that it cannot be updated because it is already open by the currently running Apache2.2 service? Although it is open read-only? I am going to check that by shutting down the service...
    – Withheld
    May 27, 2015 at 19:57
  • 1
    I'm afraid I don't know how Apache behaves with respect to file handles on Windows, since I admin it only on Linux. You might want to look for a permissions problem if the "-c" option wasn't the solution. Your test of shutting down the service may not help, but it won't hurt, so it's worth a try.
    – Scott
    May 27, 2015 at 20:00
  • OK. That was quick. I could not stop the Apache2.2 service (permission denied). Which led me to suspect that I am not running the htpasswd with enough permission (although I do belong to the Administrators group). So, I fired up the CMD but as Administrator and lo & behold it worked! Please update your answer accordingly so that I can accept it. :)
    – Withheld
    May 27, 2015 at 20:02

You must log in to answer this question.

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