Solved

htaccess -problems getting it to authenticate

Posted on 2004-08-23
2
281 Views
Last Modified: 2010-03-04
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
Comment
Question by:manta357
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 150 total points
ID: 11875817
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
 

Author Comment

by:manta357
ID: 11884622
thanks that got me on the right track. Was a problem with the ownership of the htpasswd file.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question