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
2
  • In what way doesn't it work ? Any relevant entries in your error log file ?
    – user9517
    Nov 23, 2011 at 11:54
  • Updated the post with that information.
    – johndir
    Nov 23, 2011 at 11:59

2 Answers 2

1

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

1
  • 2
    Please point people at the correct documentation! http://httpd.apache.org/docs/current/mod/core.html#allowoverride
    – adaptr
    Nov 23, 2011 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)

1
  • 1
    Please point people at the correct documentation! http://httpd.apache.org/docs/current/howto/htaccess.html
    – adaptr
    Nov 23, 2011 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .