|
2.7. Password
Protecting Web Directories
QUICK
TIP:
If
you are a FrontPage user, you should use the password
protection tool that comes with FrontPage EXCEPT when
password protecting your webstats directory. More
detail
IMPORTANT:
You will need to use both FTP and Telnet to use this feature.
This means if you have Value Plan, you wouldn't be able to use
this feature.
2.7.1.
Using .htaccess
Suppose
your domain name is foobar.com and want to password protect
http://foobar.com/members/ you would need to do the
following:
1)
Using a text editor such as Notepad in your local PC, create a
file called ".htaccess". Note that there is a
period in front of htaccess. The file should contain following
lines:
---COPY
EVERYTHING BELOW--------------------
AuthUserFile /home/foobar/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
<Limit GET POST>
require user Spock
</Limit>
---COPY UP TO THE LINE ABOVE---------------
IMPORTANT: DON'T forget to
replace "foobar" with your own domain name. Please
don't include .com or .net extensions.
2)
Save the file in plain text.
3)
Upload the file via FTP
to /www/foobar/member/ Make sure you are uploading
it in ASCII (plain text) mode.
4)
Log onto your account on our server via Telnet.
5)
Type following line at the command prompt and hit return:
htpasswd
-c /home/foobar/.htpasswd Spock
This
will create a file named .htpasswd in your
home directory.
6)
you will be prompted to type in the password for Spock.
7)
Let's say you want to add another user called Kirk.
8) Type folling line at the command prompt and hit return:
htpasswd /home/foobar/.htpasswd Kirk
9)
You would then add "require user Kirk" to your
.htaccess. It would look like this:
---COPY EVERYTHING BELOW--------------------
AuthUserFile /home/foobar/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
<Limit GET POST>
require user Spock
require user Kirk
</Limit>
---COPY UP TO THE LINE ABOVE---------------
10) That's it. Test it by visiting http://foobar.com/member/
You will be prompted to enter username and password.
2.7.2
Adding Additional Users and Passwords pairs
1)
Again telnet to your account.
2)
Type following line at the command prompt and hit return:
htpasswd
/home/foobar/.htpasswd Sulu
IMPORTANT:
DON'T forget to add "require user Sulu" to your
.htaccess file.
3)
You may reuse existing user/password combinations that you
created in your .htpasswd file to allow access other password
protected directories -- just use the right user name in the
.htaccess file.
IMPORTANT:
You
should store the .htpasswd file in your home directory so it
is hidden from others.
|