PDA

View Full Version : Password protecting directories/folders on the virtual servers.


Deacon Blue
01-22-2002, 12:00 PM
How do we go about password protecting a directory or folder, used for site development, so that only select users can gain access. We're currently running on a virtual server.

Tom

Ness
01-22-2002, 01:34 PM
You have to create a .htaccess and .htpasswd file in the directory you wish to protect. In order to do this you will need to log in using Telnet and cd into the directory you want to secure. Then, type:


pico .htaccess


After that type the following (replacing www.yoursite.com (http://www.yoursite.com) with your website address):


AuthUserFile /home/sites/www.yoursite.com/web/private/.htpasswd
AuthName "Private Directory"
AuthType Basic

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


Now, hit Ctrl+X and then 'y' to save the file. Next type the following (replacing username with the username you want to use to secure the directory):


htpasswd -c .htpasswd username


You will be prompted for the password that will be used to secure the directory. After entering this type:


chmod 644 .htaccess
chmod 644 .htpasswd


If you have done everything correctly, you should not be able to view the directory in your web browser without the password. If you have any problems, feel free to E-mail me.

I hope that helps =)

Ness
01-22-2002, 01:38 PM
That buggy sensorship is really annoying. It would be okay if it actually worked, but it doesn't.

Ness
01-22-2002, 01:52 PM
If you would like more information about p***word protecting directories, there is a nice tutorial at http://www.cgi101.com/cl***/p***word/

In the section "Creating a User Registration CGI", they teach you how to make a CGI Script that allows people to register for access to the p***word protected directory, which you may or may not be interested in.

Ness
01-22-2002, 01:57 PM
Look at that, because of that buggy censhorship you can't even post a working url!!

Sorry, you will have to replace the *'s with the correct letters. You know what they are.

Atjeu
01-22-2002, 02:11 PM
Censorship should be fixed now - ass password - just checking http://www.atjeu.com/ubb/smile.gif

Atjeu
01-22-2002, 02:12 PM
**** ****

just checking some censorship words

Deacon Blue
01-23-2002, 08:20 AM
Originally posted by Ness:
You have to create a .htaccess and .htpasswd file in the directory you wish to protect. In order to do this you will need to log in using Telnet and cd into the directory you want to secure. Then, type:


pico .htaccess


After that type the following (replacing www.yoursite.com (http://www.yoursite.com) with your website address):


AuthUserFile /home/sites/www.yoursite.com/web/private/.htpasswd
AuthName "Private Directory"
AuthType Basic

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


Now, hit Ctrl+X and then 'y' to save the file. Next type the following (replacing username with the username you want to use to secure the directory):


htpasswd -c .htpasswd username


You will be prompted for the password that will be used to secure the directory. After entering this type:


chmod 644 .htaccess
chmod 644 .htpasswd


If you have done everything correctly, you should not be able to view the directory in your web browser without the password. If you have any problems, feel free to E-mail me.

I hope that helps =)

Thanks! We'll give it a try.

Deacon Blue