2

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
johndir
  • 305
  • 1
  • 5
  • 9

2 Answers2

1

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

Jonathan
  • 575
  • 1
  • 7
  • 17
  • 2
    Please point people at the correct documentation! `http://httpd.apache.org/docs/current/mod/core.html#allowoverride` – adaptr Nov 23 '11 at 12:23
0

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)

cosmorogers
  • 101
  • 2
  • 1
    Please point people at the correct documentation! `http://httpd.apache.org/docs/current/howto/htaccess.html` – adaptr Nov 23 '11 at 12:24