Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

# 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

.htaccess:

$ 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

2 Answers 2

up vote 0 down vote accepted

Are you allowed to overwrite authentication settings using htaccess files? See http://httpd.apache.org/docs/current/mod/core.html#allowoverride

share|improve this answer
1  
Please point people at the correct documentation! http://httpd.apache.org/docs/current/mod/core.html#allowoverride –  adaptr Nov 23 '11 at 12:23

Have you allowed overrides in your apache config? http://httpd.apache.org/docs/current/howto/htaccess.html

(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
1  
Please point people at the correct documentation! http://httpd.apache.org/docs/current/howto/htaccess.html –  adaptr Nov 23 '11 at 12:24

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.