Gotcha of the day – Apache Basic Authentication on Windows

I’ve just lost almost an entire day to this, so in case anyone else ever runs up against the same problem, I thought I’d document it here.

The issue

Trying to setup Trac on Windows (I know, I know – not my choice!), I found I couldn’t log in to my Trac project using Apache’s Basic Authentication. I started with the BitNami Trac Stack, which seemed to work fine, but my credentials simply weren’t being accepted when I followed the standard instructions for setting up Apache authentication for Trac.

The problem

As I eventually worked out, the default encyrption mechanism when generating a password file using htpasswd at the command line is crypt. And, as TFM will tell you, crypt is Unix only. After chasing my error through plugins, permissions, spelling and more, it turned out I’d written a password file that my OS couldn’t understand. Sigh.

The maddeningly simple fix

Re-generate the htpasswd file, passing the -m flag to htpasswd.

Leave a Reply

Your email address will not be published. Required fields are marked *