Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 9th, 2001, 10:18 PM
unluckyboy unluckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: L.A.
Posts: 49 unluckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Question Authentication (.htaccess) problems

Ok so I got webalizer running on my pc (pretty cool tool) and I want to password protect the directory so being the newbie on my way to beginer I checked appache.org. My weberserver directory is /usr/local/apache/htdocs In bash I ran htpasswd -c .htpasswd username and once prompted i put in my password, so now when i cat .htpasswd its says username:giBerSHish. That part I think i did right, now in my stats directory /usr/local/apache/htdocs/stats which is where webalizer outputs its file i ran the command (pico is my favorite editor) pico .htaccess and typed in the following:

AuthName "Webserver Stats"
AuthType Basic
AuthUserFile /usr/local/apache/htdocs/.htpasswd

require valid-user

then i saved the file and restarted apache, and accsessed mydomain.com/stats and to my surprise it didn't ask me for a password. so i am stomped, i am pretty new to linux so i don't know if this has something to do with file permissions or something i have enable in httpd.conf. I am running apache 1.3.19 on suse 7.2 thanks for all the help before hand.
__________________
Have a lot of fun...

Reply With Quote
  #2  
Old October 9th, 2001, 11:54 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You need:

<Directory "/usr/local/apache/htdocs/stats">
AllowOverride AuthConfig
Options xxx
...
...
</Directory>

Or

<Directory "/usr/local/apache/htdocs">
AllowOverride AuthConfig another
Options xxx
...
...
</Directory>

Where another is another directive-type.
Start here -> http://httpd.apache.org/docs/mod/co...l#allowoverride

Reply With Quote
  #3  
Old October 11th, 2001, 09:26 PM
unluckyboy unluckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: L.A.
Posts: 49 unluckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Thanks a lot freebsd it now prompts me for a pasword, but when i try the username and password i have stored in /usr/local/apache/htdoc/.htpasswd they don't work my .htacces now looks the same be i added to /etc/apache/httpd.conf
<Directory "statsdirectory">
AllowOverride AuthConfig
</Directory>

Reply With Quote
  #4  
Old October 12th, 2001, 07:10 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> i have stored in /usr/local/apache/htdoc/.htpasswd they don't work

Password incorrect or what?

Show us your .htpasswd. Or add another sample user and password, then tell us the original password and show us your .htpasswd. Then I can test if they match or not.

Reply With Quote
  #5  
Old October 17th, 2001, 07:49 AM
FlashKID FlashKID is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 5 FlashKID User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I've have a simular problem. The famous 500 error.

Config: Apache latest
OS: Win2000 advanced server

My http.conf:

<VirtualHost *>
DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/web"
ServerName www.myserver.com
ServerAlias myserver.com

</VirtualHost>
<Directory "C:/Program Files/Apache Group/Apache/htdocs/web">
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
</Directory>

My .htacces

AuthUserFile c:/program files/apache group/apache/htdocs/web/.htpasswd
AuthGroupFile ResourceConfig nul
AuthName myserver
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>

Reply With Quote
  #6  
Old October 17th, 2001, 04:41 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> AuthUserFile c:/program files/apache group/apache/htdocs/web/.htpasswd

When your directory has space, Apache doesn't like it and you MUST quote your path like so:

AuthUserFile "c:/program files/apache group/apache/htdocs/web/.htpasswd"

Reply With Quote
  #7  
Old October 17th, 2001, 04:56 PM
FlashKID FlashKID is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 5 FlashKID User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Did that in the first place. But still getting the Internal Server Error.

Reply With Quote
  #8  
Old October 17th, 2001, 05:06 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry, I have to say that I know nothing with Apache on win32.

>> The famous 500 error

Normally this is caused by your script. If you are sure it's not a problem with your script and it must be Apache, then there is only one possible cause:

You have placed something in .htaccess that Apache can't understand.

Note, I said .htaccess instead of httpd.conf. If you misconfigured your httpd.conf, Apache would throw you error upon startup.

Reply With Quote
  #9  
Old October 17th, 2001, 05:15 PM
FlashKID FlashKID is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 5 FlashKID User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well, there's nothing wrong with script.

If i replace these lines in http.conf:
AllowOverride AuthConfig
</Directory>

to:

AllowOverride None
Order allow,deny
Allow from all
</Directory>

the site loads up.

And about the .htaccess, i posted it here.
Nothing wrong with it neither.

Could it be a bug in Apache?

Reply With Quote
  #10  
Old October 17th, 2001, 05:21 PM
FlashKID FlashKID is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 5 FlashKID User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My error log shows ".htaccess: Invalid auth file type: nul"
hmm..strange.

Reply With Quote
  #11  
Old October 17th, 2001, 06:34 PM
unluckyboy unluckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: L.A.
Posts: 49 unluckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
sorry for the stall in a reply i was out of town
This is what my .htpasswd file looks like

user:7MyUTzz8kVAbM

I was wondering if there had to be any special file permissions on .htpasswd?

Reply With Quote
  #12  
Old October 17th, 2001, 07:01 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> user:7MyUTzz8kVAbM

How about the original password?

>> f there had to be any special file permissions on .htpasswd?

No. It just needs to be readable by Apache.

Reply With Quote
  #13  
Old October 17th, 2001, 07:04 PM
FlashKID FlashKID is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 5 FlashKID User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>>>>> user:7MyUTzz8kVAbM

How about the original password?

looks like MD5

Reply With Quote
  #14  
Old October 17th, 2001, 09:39 PM
unluckyboy unluckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: L.A.
Posts: 49 unluckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
the pasword is user the username is user

Reply With Quote
  #15  
Old October 17th, 2001, 10:19 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> the pasword is user the username is user

The password is correct.

Here is a simple script to verify it:

#!/usr/bin/perl

$passwd = 'user';
$encrypt = '7MyUTzz8kVAbM';

$crypt = crypt($passwd,$encrypt);
if ($crypt eq "$encrypt") {
print "Password Correct\n";
}
else {
print "Password Incorrect\n";
}

Say you have:

AuthName "Webserver Stats"
AuthType Basic
AuthUserFile /non-existence/path/to/.foobar
require valid-user

in /usr/local/apache/htdocs/stats/.htaccess

and with AllowOverride AuthConfig in <Directory "/usr/local/apache/htdocs/stats">

Despite the non-existence .foobar file Apache unable to locate, you would still get the authentication prompt and a password incorrect in return.

That said, you need to make sure your .htpasswd file is readable by the user Apache runs as. So check your error_log and find out why that happened.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Authentication (.htaccess) problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump