Solved

htaccess -problems getting it to authenticate

Posted on 2004-08-23
2
277 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
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now