Link to home
Start Free TrialLog in
Avatar of manta357
manta357

asked on

htaccess -problems getting it to authenticate

Hi all,
I'm try to protect some folders using htaccess and can't seem to get it working, it just won't authenticate when I go into the test folder. I'm prompted to enter a password, it never accepts it and after 3 attemps brings up the Authentication Required Error 401 page.
It's Apache running under RedHat 9.
The .htaccess file is placed into the test folder /var/www/html/test and it is:
AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /dev/null
AuthName "Secure Section"
AuthType Basic
require valid-user

I create user 'test' for the .htpasswd file in /var/www/html using the command:
htpasswd -c .htpasswd test
...and enter a password.

The file gets created ok and contains:
test:passwordhash

The httpd config file has AllowOverride set to All. From the httpd.conf file:

# First, we configure the "default" to be a very restrictive set of
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<LocationMatch "^/$>
    Options -Indexes
    ErrorDocument 403 /error/noindex.html
</LocationMatch>

<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>

<Directory /home/*/public_html>
    AllowOverride All
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

DirectoryIndex index.html index.html.var

AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

-----
Any ideas on what the problem is or what to check out next?

cheers
Andrew

ASKER CERTIFIED SOLUTION
Avatar of ramazanyich
ramazanyich
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of manta357
manta357

ASKER

thanks that got me on the right track. Was a problem with the ownership of the htpasswd file.