Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-30-2004, 01:58 PM
|
#1
|
LQ Newbie
Registered: Mar 2004
Location: Holland
Distribution: Redhat 9/FC1-2
Posts: 10
Rep:
|
Apache: trouble with .htacces
Hello all,
I'm trying to configure apache in a way that it will only allow registered users on a username/passwd basis.
It runs on a RH 9 box , Apache version 2.0.40
The sites content is in /var/www/html/ so that is where I've put my .htaccess file
which looks like this:
AuthType Basic
AuthName "Restricted files"
AuthUserFile /usr/local/httppasswords
require user foo
I changed AllowOverride for the /var/www/html/ dir from None to Autconfig
Then I used htpasswd to create a user foo:
# htpasswd -c /usr/local/httppasswords foo
and set the passwd to "bar"
In the /user/local/httppasswords file there's a line:
foo:1h3barlk12
But when I log on to my web page I get prompted for my username and passwd over and over again, without letting me acces the page. It doesn't say : login failed or anything, it just keeps prompting me.
I can acces the page just fine when I don't use the .htaccess file.
I've googled on this but to no avail :-(
Any suggestions?
|
|
|
04-30-2004, 04:13 PM
|
#2
|
LQ Newbie
Registered: Sep 2003
Location: Harrisburg, PA
Distribution: Mandrake 10
Posts: 16
Rep:
|
I don't know if this will help, but what if you hid the httppasswords file? maybe rename it to .httppasswords, and point the htaccess file to that?
|
|
|
04-30-2004, 06:01 PM
|
#3
|
LQ Newbie
Registered: Mar 2004
Location: Holland
Distribution: Redhat 9/FC1-2
Posts: 10
Original Poster
Rep:
|
I tried that, but sadly it didn't solve the problem. It's probably something basic I'm not getting. I tried chmodding the files involved to 777, but that didn't do it either. Could it be that the .htaccess file is in the wrong directory or something like that?
I moved it around a little, but I keep having the above problem.
|
|
|
04-30-2004, 06:51 PM
|
#5
|
Member
Registered: Apr 2004
Distribution: Debian
Posts: 80
Rep:
|
the password file can be placed anywhere, but i would strongly recommend placing it outside of the DocumentRoot, so that it cannot be downloaded
and while that website is handy, it just implements one use of the htpasswd command
if you only have 1 user, foo, in the password file, try using the valid-user directive instead of require user foo
AuthUserFile /usr/local/httppasswords
AuthGroupFile /dev/null
AuthName "Restricted files"
AuthType Basic
<Limit GET PUT POST>
require valid-user
</Limit>
Last edited by Matt Collier; 04-30-2004 at 06:56 PM.
|
|
|
05-02-2004, 08:13 AM
|
#6
|
LQ Newbie
Registered: Mar 2004
Location: Holland
Distribution: Redhat 9/FC1-2
Posts: 10
Original Poster
Rep:
|
Hi everyone,
Sorry for reacting this late, but yesterday didn't go as planned for me, so I wasn't able to get behind my pc.
I just tried all the suggestions you guys made and I am very sorry to say nothing worked.
I tried starting over from scratch, and naming every file exactly as in the tutorial Grandpuba provided. Still to no avail.
Since I do get prompted, would it be save to presume that my httpd.conf file is configured correctly and the problem is somewhere within the way Apache handles the username/passwd input?
Maybe something redhat-specific? (I installed apache along with the rh9 server install)
Could it be I should have a module that isn't compiled in the rpm or something?
Last edited by dowski; 05-02-2004 at 09:34 AM.
|
|
|
05-02-2004, 11:33 AM
|
#7
|
LQ Newbie
Registered: Mar 2004
Location: Holland
Distribution: Redhat 9/FC1-2
Posts: 10
Original Poster
Rep:
|
PROBLEM SOLVED!!!
I realized just a moment ago that I didn't chmod the .htacces and .htpasswd file after following the instructions on "Grandpuba's" tutorial. I made them as root...
After I did that it functioned perfectly.
Who would have thought file permissions could get you in to trouble?
What was wrong the first time I will probably never know, something similar probably...
Thanks a million guys!
|
|
|
05-05-2004, 02:16 PM
|
#8
|
LQ Newbie
Registered: May 2004
Posts: 1
Rep:
|
what's the chmod value??
i'm having the exact same problem as dowski
what should be the chmod value of the .htpasswd file
i have it at 750
owner: apache
group: apache
its driving me crazy!
|
|
|
05-07-2004, 12:45 PM
|
#9
|
LQ Newbie
Registered: Mar 2004
Location: Holland
Distribution: Redhat 9/FC1-2
Posts: 10
Original Poster
Rep:
|
I can't say for sure what it was from where I am right now, but the method I used was:
Start at 777 and work your way down. I think all users should have read acces.
Man! Do I know what you mean!
|
|
|
05-17-2004, 11:58 PM
|
#10
|
LQ Newbie
Registered: Feb 2004
Posts: 4
Rep:
|
I had the same problem. I set the permisions to 744 and it worked. Frustrating how all those tutorials never mentioned permisions, guess thats what this site is for! Good luck!
|
|
|
All times are GMT -5. The time now is 07:05 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|