www.phpwebhosting.com

Adding Password Protection To A Directory
Step-by-Step

1.) In the directory you want to protect, create a file called .htaccess (yes, a "dot" is the first letter of the file name). Note: files that start with a "dot" are "hidden" files in unix. To view them with the "ls" command you must use the "-a" switch(ie. "ls -a").

2.) Inside this file put the following:

AuthUserFile /home/your_username/.htpasswd
AuthGroupFile /dev/null
AuthName "Private"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>
3.) Next, create the password file by doing the following:

htpasswd -c /home/your_username/.htpasswd username1

Replace "username1" with the name of the first user you would like to add.

4.) To add more users, type:

htpasswd /home/your_username/.htpasswd next_username

Notice that this time you did not user the "-c" switch. The "-c" is only used when you are creating a brand new password file.

For more help on this subject visit http://bignosebird.com/passwd.shtml for more help!


www.phpwebhosting.com