Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

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

0
manta357
Asked:
manta357
1 Solution
 
ramazanyichCommented:
It seems that apache server can't read .htpasswd file. Check errors log file of apache server. Check also that user who owns httpd processes has access to .htpasswd file
0
 
manta357Author Commented:
thanks that got me on the right track. Was a problem with the ownership of the htpasswd file.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now