Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to setup basic HTTP authentication with Apache, but it's not working. I get the directory listing and files regularly, no authentication required. I tried restarting httpd and the browsers cache.

I can't find any relevant entries in /var/log/httpd/error_log.

Any ideas?


# htpasswd -c /usr/local/share/passwords username
$ ls -l /usr/local/share/passwords 
-rw-r--r-- 1 root root 44 Nov 23 13:29 /usr/local/share/passwords


$ cat /srv/http/test/.htaccess 
AuthType Basic
AuthName "Some Stuff"
AuthUserFile /usr/local/share/passwords
Require user username

The directory:

$ ls -la /srv/http/test/
total 16
drwxr-xr-x 2 root root 4096 Nov 23 13:27 .
drwxr-xr-x 4 root root 4096 Nov 23 00:40 ..
-rw-r--r-- 1 root root   96 Nov 23 13:35 .htaccess
-rw-r--r-- 1 root root   14 Nov 23 00:40 page.html
share|improve this question
In what way doesn't it work ? Any relevant entries in your error log file ? – Iain Nov 23 '11 at 11:54
Updated the post with that information. – johndir Nov 23 '11 at 11:59
up vote 1 down vote accepted

Are you allowed to overwrite authentication settings using htaccess files? See

share|improve this answer
Please point people at the correct documentation! – adaptr Nov 23 '11 at 12:23

Have you allowed overrides in your apache config?

(Sorry for old link. If you are using an older version of apache then replace 'current' with the version you are using, eg 2.0, etc)

share|improve this answer
Please point people at the correct documentation! – adaptr Nov 23 '11 at 12:24

Your Answer


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.