| Support Home > VPS v1 > Webserver > Configuration > | Monday, October 06, 2008 | ||||||||
Creating Password Protected DirectoriesWhat you are trying to do is called "user authentication". The best place to learn about user authentication is from the source (NCSA). They have a very easy to understand tutorial at the following URL: http://hoohoo.ncsa.uiuc.edu/docs/tutorials/user.htmlYou should be aware of one subtle difference with the Virtual Server System-- when you set up your .htaccess files, you will specify the AuthUserFile or AuthGroupFile with respect to your home directory. However, when you set up your .htpasswd files with the htpasswd command you will need to prepend /usr/home/[login_name] to the directory specification. NOTE: If you will be authenticating thousands of users, or more, you should consider DBM User Authentication which works much faster and more efficiently with a larger number of users.For example, let's say you have a subdirectory billy in your ~/www/htdocs directory. You would like to restrict access to this directory. This can be done by first creating a .htaccess file in the billy subdirectory such as the following: AuthUserFile /etc/.htpasswdThis .htaccess file will only allow one user, "William", to access the directory billy; provided the correct password is given. The password is to be stored in the /etc/.htpasswd file (see the AuthUserFile declaration in the .htaccess file above). To set up the password for "William" issue the following command: % htpasswd -c /usr/home/[login]/etc/.htpasswd WilliamUse the htpasswd command without the -c flag to add additional users; e.g.: % htpasswd /usr/home/[login]/etc/.htpasswd peanuts NOTE: To run the htpasswd command correctly, you will need to prepend the /usr/home/[login_name] path to the password file specification (substitute your login name for [login_name]). You do not need to use the /usr/home/[login_name] path in the .htaccess file. |
|
| Home | Site Map | Customer Backroom | Copyright © 1997-2008 AlpineWeb Design |