How do I password protect a directory?
For this example, we will show you how to password protect
a the directory named members. ie.{http://www.domain.com/members}.
You can apply this procedure to user sites also by changing the directories.
1. Telnet in, and login with your username and password.
note: Your site and username must have Telnet access enabled.
2. Create the .htaccess file, it should contain at least the following
lines:
require valid-user
Authname "My Protected Page"
Authtype Basic
AuthUserFile /home/sites/www.domain.com/web/members/.htpasswd
NOTE: The AuthUserFile should be in the directory
that you want to password protect. The above example shows how to
protect the 'sitename' site.
3. Now we want to create the htpasswd file using
the htpasswd command in the /usr/sbin/ directory. type:
/usr/bin/htpasswd -c /home/sites/www.domain.com/web/members/.htpasswd
username
It will prompt you for the password twice
NOTE: The -c flag in this command signifies that it must create the
file. To add further users to the htpasswd file, repeat the same command
WITHOUT the -c flag.