Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.htaccess not working

Status
Not open for further replies.

pgosse

Programmer
Sep 26, 2001
42
0
0
CA
Hi, folks. I'm running into a very strange problem.

I've got the public_html folders of two home directories that I'm using .htaccess to protect. If I access them via any one of our virtual hosts running on this box ( they both work fine. However, if I access them using the machine name (ie. my-machine-05.mydomain.com/~username) one works and the other does not.

Since these are user accounts, not virtual servers, I'm suspecting the problem lies somewhere in the permissions or something, and not in the configuration file, since if it was in the config, I assume it would be a problem for both.

Both directories are found at /home/{username}/public_html/. In the exaamples below where I list directory contents, I'm eliminating everything other than the directories in question.

For the user home directories:

[webmstr@mydomain home]$ ls -l
drwx--x--x 12 pablo pablo 4096 Apr 6 09:12 pablo
drwx--x--x 13 webmstr webmstr 4096 Apr 6 09:25 webmstr


So as you can see, the permissions on the home directories are the same.

For the public_html directories:

[webmstr@mydomain home]$ ls -l
drwxr-xr-x 2 webmstr webmstr 4096 Apr 5 16:15 public_html


and

[pablo@mydomain pablo]$ ls -l
drwxr-xr-x 2 pablo pablo 4096 Apr 6 09:11 public_html


and after that, the .htaccess files:

[webmstr@mydomain webmstr]$ ls -la public_html/
-rw-rw-r-- 1 webmstr webmstr 96 Mar 29 19:21 .htaccess


[pablo@mydomain pablo]$ ls -la public_html/
-rw-rw-r-- 1 pablo pablo 92 Apr 6 09:11 .htaccess

the contents of which are:

Webmstr .htaccess file:

AuthUserFile /home/webmstr/password
AuthName "Work Related"
AuthType Basic
require user webmstr


Pablo .htaccess file:

AuthUserFile /home/pablo/password
AuthName "Work Related"
AuthType Basic
require user pablo


So as you can see, everything seems to be the same. To me at least.

As I said above if I access them via any one of our virtual hosts running on this box (ie. they both work fine.

However, if I access them using the machine name (ie. my-machine-05.mydomain.com/~username) I get prompted to enter my un/pw for the pablo account, but not for the webmstr account.

Can anyone out there provide any insight to this? I'm by no means an expert on Apache, but I am quick study, very competent and can usually identify problems pretty quickly, however this one has me stumped.

Cheers and TIA.

Pablo
 
I would guess that webmstr might be an account local to the machine, whereas pablo might be a remotely authenticated user?
 
I'm not sure I understand what the difference would be?

Both seem to me be accounts "local" to the machine, though I never log directly into the physical machine. Can you explain this?

Cheers and TIA,

Pablo

 
pgosse,

You say that both directories are accessible by the URL but not
What do you have for VirtualHosts in your httpd.conf? Do you have a default? What error message do you get with the one that is not accessible by
Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Both directories can be accessed by both urls you mention, it's just that the ~pablo account gets prompted to enter a username/password, while the ~webmstr account does not, even though they have their own .htaccess files in each.

I dont' get any errors, it's just that the .htaccess seems to work in one, but not the other. But as you can see from the information in my original post, both are configured exactly the same. If there's a difference, I'm not seeing it.

There are a number of domains on this server, such as cms.mydomain.com and cms-test.mydomain.com. Each of these virtual servers has its own conf file for both http and https, which are loaded in in the VirtualHost blocks of the main conf file.

In this main conf file, the following directory blocks define the ~username accounts.

<Directory /u0/home/*/public_html/>
Options MultiViews SymlinksIfOwnerMatch Indexes
AllowOverride All
</Directory>

<Directory /u0/home/*/public_html/cgi-bin/>
Options ExecCGI SymlinksIfOwnerMatch Indexes Multiviews
AddHandler cgi-script .cgi
</Directory>


Before this, however, there exists the following disclaimer, but I can't see what would not be enabled that would be causing this problem.

# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.


This is very strange to me. Is there anything in my original post that might indicate what's causing this? I'm completely stumped on this one.

Normally I would think that this would cause something to show up in the error log, but there's no error being thrown that i can see. It just does not prompt for the username/password and immediately loads up the index page in the public_html directory.

Any ideas?

Cheers and TIA,

Pablo
 
pgosse,

Nothing jumps out at me as strange with your configuration. Just to cover all the bases, you have restarted the Apache server since making these changes, right?

I can see Apache throwing an error if /home/webmstr/password doesn't exist, but it should still prompt for login credentials.

What I would do is double check the VirtualHosts, delete the .htaccess in /home/webmstr and copy the .htaccess from /home/pablo to /home/webmstr. It's possible, however unlikely, that the .htaccess in /home/webmstr is corrupt.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top