Web Hosting Talk







View Full Version : Protecting directories


kentaurus
02-03-2001, 10:23 PM
Hi everybody

I just got a raq3 with 4webspace, still moving. This is my first time with a dedicated server, and I am starting to miss all that small things a good host usually do for me.

I am trying to guess how to password protect a directory, I tried creating a .htpasswd and an .htaccess file with "require valid-user" and an AuthUserfile.. no luck, the password box prompts when I enter but it won't accept any password in the .htpasswd file. Any ideas?

jtan15
02-03-2001, 10:56 PM
Put this in your .htaccess file:

AuthName "Name of restricted area"
AuthUserFile /path/to/.htpasswd
AuthType Basic

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

Then execute the following command on the cobalt:

"htpasswd -c /path/to/.htpasswd username"

It will then prompt you for the password. Enter it, and it should be setup. After setting up the first username, do not use the -c option to add more usernames.

Hope this helps! If you get an error saying "htpasswd" not found, try a "whereis htpasswd" and then use that pathname. :)

kentaurus
02-03-2001, 11:01 PM
Thanks Vince, the problem is that apache won't use the .htpasswd file, I have checked that the AllowOverride directive is set to All but with no good result

If I try to authenticate with my admin password of the raq it gives me access (ie - it's using my etc/passwd), but it doesn't use any file I specify with AuthUserFile

allan
02-04-2001, 01:56 AM
Make sure you turn AuthPAM_enabled off, its flake of the RaQs.

like this:

AuthUserFile /home/sites/site#/.htpasswd
AuthGroupFile /dev/null
AuthName "Site Name"
AuthType Basic
AuthPAM_enabled off

<limit GET PUT POST>
require valid-user
</limit>

allan

kentaurus
02-04-2001, 10:16 AM
Thanks'a lot! it worked perfectly. Yesterday I messed through the apache and raq documentation with no luck.. this raq is becoming more tricky than I though :)

aura9
05-23-2001, 04:27 PM
I think that the .htaccess file is not recognizing my password file. Is there something I need to change in the Apache configuration to make sure that it works? I've already added the following:

access.conf
<Directory /home/sites/site4/web/phpMyAdmin/>
AllowOverride All
Options All
</Directory>

.htaccess
AuthUserFile /home/sites/site#/.htpasswd
AuthGroupFile /dev/null
AuthName "Site Name"
AuthType Basic
AuthPAM_enabled off

<limit GET PUT POST>
require valid-user
</limit>

I'm a newbie to this forum and any help would be greatly appreciated.:D

BTW. I'm on a RaQ4i

Thanks!

WreckRman2
05-24-2001, 11:38 PM
There is a doc at tera-byte.com that explains how to do this on thier Raq's.

aura9
05-25-2001, 12:55 AM
Thanks a lot. I've got the problem solved. It was something in my access.conf file. Thanks for the response though, I appreciate it.

aura9
05-25-2001, 01:20 AM
By the way...

I also had a problem with the following:

<limit GET POST PUT>
require valid-user
</limit>

When I read that I thought that it meant to put a valid user name as follows:

<limit GET POST PUT>
require someusername
</limit>

Being a newbie I'm sure that some other other people just starting out have had a similar problem. After trying several things I've found that this works:

Either leave it as...

require valid-user

OR

require user someusername

They both work. ;)

SI-Chris
05-25-2001, 05:41 AM
You should check out the Cobalt Knowledgebase, it's got answers to questions like these (although it is by no means comprehensive):
http://www.cobalt.com/support/kb/index.php3

aura9
05-25-2001, 10:41 AM
Yeah... It is by no means comprehensive. I've found WHT to be a great resource for help and information.

Does anyone know of any other sites like WHT?

:rolleyes: