Your Virtual Server Apache Web Server supports user authentication.
In other words, it allows you to create password protected directories on your Virtual Server web site.
Let's say you want to restrict access to a the following directory
to those with a valid username and password.
You can do this by connecting
to your Virtual Server via
Telnet or SSH and
following the steps below.
Create a file named .htaccess in your ~/www/htdocs/billy
directory that allows only allow one user (
access the directory.
The .htaccess file must reside in the ~/www/htdocs/billy
directory in order to control access to the ~/www/htdocs/billy
You can either create the .htaccess file while connected to your Virtual Server
(using a file editor like pico, for example) or you can create the file on your own PC and
Upload it to your Virtual Server.
The file should contain the following text, depending on your Virtual Server O/S.
FreeBSD & Solaris
AuthName "Bill's Restaurant"
require user William
Do not include the quotation marks in the "
AuthName Bill's Restaurant" text:
AuthName Bill's Restaurant
require user William
If you don't know the Virtual Server O/S, try the following:
Use the htpasswd command to set a password for the new user.
Substitute your Virtual Server login name for
% htpasswd -c /usr/home/LOGIN-NAME/etc/.htpasswd William
You are free to use a different name or directory location for the password file.
Just change the
/usr/home/LOGIN-NAME/etc/.htpasswd above to
whatever you want.
-c flag indicates that you are adding a user to the .htpasswd file
for the first time. When you add more users and passwords to the same .htpasswd file, do
not use the
-c flag, as that will erase all your previous entries in the file.
% htpasswd /usr/home/LOGIN-NAME/etc/.htpasswd peanuts
% htpasswd /usr/home/LOGIN-NAME/etc/.htpasswd almonds
% htpasswd /usr/home/LOGIN-NAME/etc/.htpasswd walnuts
The best place to learn about user authentication is from the source (NCSA).
You should be aware of one subtle difference with the Virtual Server
system. When you set up your .htaccess files, you specify the
AuthGroupFile with respect to
your home directory. However, when you set up your .htpasswd files
with the htpasswd command you need to prepend
/usr/home/LOGIN-NAME to the directory specification.
Site Map | Contact Us!
Copyright © 1998-2001 Bright Builders, Inc. All rights reserved.
Last Modified: Fri May 11 16:51:28 2001 GMT
Page Built: Mon Jul 2 19:59:11 2001 GMT