Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 10th March 2008, 00:38
pcburner pcburner is offline
Member
 
Join Date: Jan 2008
Location: Port Huron, MI
Posts: 32
Thanks: 2
Thanked 1 Time in 1 Post
Send a message via AIM to pcburner
Default apache configuration

Ok here's the deal I learned how to protect some directories that require username and password to gain access. Now I've changed the password several times along with the username and still no luck. Now here's the thing that puzzles me, for the information that I've been able to gather everyone states this command- htpasswd -c /path/to/passwords/passwd username but when I use that command I keep get an error. So I tried this- htpasswd -c /path/directory/.htpasswd username and that worked. Now when I click on the link for the directory I get a username and password pop-up. I enter in the info, and nothing happens it keeps coming back blank as though the info I gave it is not correct. What is it the I don't have correct? Also perhaps this might help for the apache config?

<Directory /path/to/directory>
AuthUserFile /path/to/.htpasswd
AuthName Protected
AuthType Basic
require valid-user
Allow 127.0.0.1
Allow 192.168.1.*
</Directory>

I also have in the .htpasswd file the path as the location of the .htpasswd file. I also believe I chmod the password file with a 644, and the .htaccess file as well. As matter of fact I just tested those files with 777 and still nothing. So what am I missing in the configuration?

I also changed the ownership and groups to apache for the protected directory before any of this.
Reply With Quote
Sponsored Links
  #2  
Old 10th March 2008, 07:49
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

Actually the first command should work, what is the error you get when you run the command ?

P.S the .htaccess file is supposed to be used to override configurations not as a passwd file.
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #3  
Old 10th March 2008, 14:14
pcburner pcburner is offline
Member
 
Join Date: Jan 2008
Location: Port Huron, MI
Posts: 32
Thanks: 2
Thanked 1 Time in 1 Post
Send a message via AIM to pcburner
Default

The error is this - access to /path/to/directory failed, reason:verification of user id 'username' not configured, referer http://servername/

Last edited by pcburner; 10th March 2008 at 14:21.
Reply With Quote
  #4  
Old 10th March 2008, 14:18
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

But your post states that you get an error
Quote:
everyone states this command- htpasswd -c /path/to/passwords/passwd username but when I use that command I keep get an error.
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #5  
Old 10th March 2008, 14:28
pcburner pcburner is offline
Member
 
Join Date: Jan 2008
Location: Port Huron, MI
Posts: 32
Thanks: 2
Thanked 1 Time in 1 Post
Send a message via AIM to pcburner
Default

Sorry about that- the error that I get is this - htpasswd can't create the directory /var/www/passwords/passwd
Reply With Quote
  #6  
Old 10th March 2008, 14:30
pcburner pcburner is offline
Member
 
Join Date: Jan 2008
Location: Port Huron, MI
Posts: 32
Thanks: 2
Thanked 1 Time in 1 Post
Send a message via AIM to pcburner
Default

I also tried this - htpasswd - c /var/www/passwd/passwords/ username and still nothing I get the same error as above htpasswd can't create the directory /var/www/passwd/passwords.
I even tried to create the directory manually and that still didn't work.
Reply With Quote
  #7  
Old 10th March 2008, 16:44
pcburner pcburner is offline
Member
 
Join Date: Jan 2008
Location: Port Huron, MI
Posts: 32
Thanks: 2
Thanked 1 Time in 1 Post
Send a message via AIM to pcburner
Default

I figured out the htpasswd command thanks to TopDog! But I think there is a conflict between Apache and the .htaccess file. I have tried different codes but nothing has worked. Here is what I have thus far in my .htaccess file.

AuthUserFile /etc/httpd/conf.d/users
AuthName "Protected Public Files"
AuthType Basic
require valid-user

Is there anything in here that I missing also what should the permissions be set at 644, 755? I've tried even 777 and that still didn't work I 've also set the permissions the .htpasswd file to 777 and that didn't work also what should those permissions be?
Reply With Quote
  #8  
Old 10th March 2008, 21:30
zetnsh zetnsh is offline
Senior Member
 
Join Date: Aug 2007
Posts: 111
Thanks: 8
Thanked 5 Times in 5 Posts
Default

Apache can be notoriously tricky on this one. A shot in the dark, but it may be related to the relevant feature (AuthConfig in this case) simply not being allowed on the server. Are you seeing something like:

"Client denied by server configuration" in the error logs?

You could try putting somewhere appropriate in your httpd.conf file (the configuration file for Apache) near the bottom (above the virtual hosts) something like:

Code:
<Directory /path/to/webuser/root>
AllowOverride +AuthConfig
</Directory>
This directive controls what Apache allows in .htaccess files. It may well be that something earlier in the config file is disabling the use of the AuthConfig functions directive.

Remember - the error log is your friend!

I have to say - I wasn't completely clear on what your problem was from your description, but there's chance this might help.

Maybe you could post an appropriate extract from your server's error log that shows what error you're getting.

Good luck!
Reply With Quote
  #9  
Old 10th March 2008, 22:21
pcburner pcburner is offline
Member
 
Join Date: Jan 2008
Location: Port Huron, MI
Posts: 32
Thanks: 2
Thanked 1 Time in 1 Post
Send a message via AIM to pcburner
Default

Here is the error that I am getting-

[Mon Mar 10 13:02:24 2008] [error] [client:000.000.000.000]access to /path/to failed, reason: user 'username' does not meet 'require'ments for user



I am not sure what this means? Is there some kind of password requirements that I don't know about or is this because it is unable to read the htpasswd file?
I have changed the permissions on it to several different settings and that didn't change anything.
Reply With Quote
  #10  
Old 10th March 2008, 22:31
zetnsh zetnsh is offline
Senior Member
 
Join Date: Aug 2007
Posts: 111
Thanks: 8
Thanked 5 Times in 5 Posts
 
Default

I think all that's saying is that you said "require valid-user" in your .htaccess file, and the authentication data supplied didn't meet that criteria. Incidentally, have you tried that with an upper case "R" at the beginning? eg. "Require valid-user" rather than "require valid-user" ?

Could it simply be that the username/password combination in your .htpasswd file have invalid characters?

You could try changing it to read something like

Code:
Require user <username>
Where obviously you replace <username> with the, erm, username!

You may get a different error if it's a .htpasswd problem, which might give you more of a clue!

Sorry I can't solve it for you, but I do try ;-)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Virtual Hosts - I have never gotten this right. DazzyB Server Operation 2 24th December 2007 13:37
Apache configuration file - Probleme bei Domain Einrichtung - Brauche dringend Hilfe knuddel Installation/Configuration 3 30th November 2006 09:40
Centos 4.4 32bit Hangs, High Server load 3cwired_com Server Operation 11 16th November 2006 15:47
Problem with the installation of Dokeos (LMS) in ISPConfig jofranco General 4 28th April 2006 00:45
ispconfig and mambo shajazzi Installation/Configuration 70 28th March 2006 19:29


All times are GMT +2. The time now is 10:27.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.