LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-30-2005, 04:34 PM   #1
mikeindo
Member
 
Registered: May 2004
Posts: 43

Rep: Reputation: 15
login problems - htaccess / htpasswd


Redhat9, Apache 2.0.

Apache serves 'unprotected' pages just fine. Create .htaccess and .htpasswd files, restart httpd, and can get a login prompt as specified in htaccess, but wont accept passwords! Just kicks back to login as if entered wrong pwd. I'm trying to login from a WinXP system. Here is .htaccess:

AuthName "Log into private area"
AuthType Basic
AuthUserFile /home/mike/.htpasswd
Require user music

So then I created .htapsswd to be in my home dir (cuz I read it's not ideal to have it in the same dir you're protecting?) with user 'music' and pwd 'musak':

htpasswd -cb /home/mike/.htpasswd music musak

After running "htpasswd --help", I saw the different encryption options and tried 'em all, but all failed the same way as above. 'music' doesnt need to be an existing user on this linux box, right? In case it did, I changed Require line to valid-user and used an existing user on this system and it still failed the same way.

Please shed some light... Thx
 
Old 09-30-2005, 05:17 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
I wonder...
Can the account that the apache daemon runs as (it would be the user httpd or apache) read that file in /home/mike? Old Redhats protect users' home directories by denying the "other" group all access. You'll need at least the 'x' access bit for "others" set for your homedirectory (drwx--x--x for instance) for apache to see that .htpasswd file.
Run
Code:
chmod o+x /home/mike
and try logging in again.
Also, the .htpasswd file itself should at least be readable by the apache process....
Code:
chmod o+r /home/mike/.htpasswd
Eric
 
Old 09-30-2005, 11:53 PM   #3
mikeindo
Member
 
Registered: May 2004
Posts: 43

Original Poster
Rep: Reputation: 15
you got it! thanks a lot!
 
Old 10-01-2005, 12:16 AM   #4
RHELL
Member
 
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
Usually the .htpasswd file is on a non-web-accessible branch of the apache tree, such as /usr/local/apache/passwords, or /etc/httpd/passwords, which makes it easier to configure for apache to read, without opening your home directory to everyone.

http://httpd.apache.org/docs/2.0/howto/auth.html
 
Old 10-03-2005, 03:18 PM   #5
mikeindo
Member
 
Registered: May 2004
Posts: 43

Original Poster
Rep: Reputation: 15
duly noted!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess .htpasswd plisken Linux - General 5 05-21-2006 01:44 PM
htaccess/htpasswd not authenticating BrianK Linux - Software 3 12-10-2004 02:52 PM
.htaccess / .htpasswd inq Robin01 Linux - Newbie 1 12-20-2003 05:36 PM
Help with .htpasswd and .htaccess MikeeX Linux - General 3 03-25-2003 10:41 AM
Cannot see .htaccess and .htpasswd files John_Saunders Linux - Newbie 2 07-21-2002 09:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration