htpasswd or htdigest ?
Gotcha! Don’t make the mistake I just made when setting up digest authentication in apache2. Depending on whether you’re using basic or digest authentication, you need to use a different command line tool to generate your passwords. After fifteen minutes of confusion, I realised that I needed htdigest to generate my passwords rather than htpasswd, although this crucial fact is not obvious from a glance at the documenation.
A typical setup for digest authentication is:
<Location /some/url> AuthType Digest AuthName "realm" AuthDigestDomain /some/url AuthUserFile /path/to/.htpasswd Require valid-user
</Location>
Then use htdigest…
htdigest -c /path/to/.htpasswd realm username
Tags: apache2, configuration