The following is a brief instructional guide to taking advantage of
the built-in "Basic" authentication scheme provided as a part of the
Netscape Enterprise webserver.
Please note that this information assumes you are working off of the
UNIX webserver, with a GP login.
The netscape server has been activated to provide directory level
security for your public_html entries. There are essentially 3 items
that need to be addressed for you to take advantage of this security
feature:
1) You need to create a .nsconfig file and move it into your public_html
directory. The contents of this file should read:
RequireAuth userfile=/home/mylogin/public_html/pass realm=stuff userpat=*
#/home/mylogin/public_html/pass should be replaced by your own path and password file...
2) You need to create a password file, which generally resembles the
passwd file on most UNIX systems. However, this file has only two
fields per line, colon separated (:)- a userid, and an encrypted password.
3) following is a perl script that allows you, the administrator of your
site, to enter users and passwords and write this to the file you
specify. Cut and paste this, and make changes where applicable.
#!/opt/WWW/perl
print "Enter userid: ";
chop($user = );
print "Enter desired password: ";
system 'stty -echo';
chop($pass = );
system 'stty echo';
print "\nPlease enter password again: ";
system 'stty -echo';
chop($pass2=);
system 'stty echo';
@junk = (A..Z,a..z,0..9);
srand(time);
$salt = "$junk[int(rand(62))]$junk[int(rand(62))]";
if ($pass eq $pass2) {
$secret = crypt($pass,$salt);
open(PASSWD, ">>pass");#enter your passwd file here
print PASSWD $user.":".$secret."\n";
close PASSWD;
print "\n"; #clears the screen with a newline
}else {
die ("\nSorry, passwords not the same. Please run the script again.\n");
}
4) This file should be saved as something like "addone" and its mod
should be set to 755. If you place the file in a directory that is
in your PATH, such as bin, when you cd to the directory you want to
create the password file in, you can simply type "addone" at the
command prompt. The file is then interactive.
5) Make sure the password file and the .nsconfig file can be read by
user nobody (chmod 644 pass).
This should now work. The user should see a dialogue box asking for login
and password whenever they try to enter the particular directory that contains
a .nsconfig file.
For cgi developers, the login id is contained in the environment variable
$ENV{'REMOTE_USER'}. This environment variable remains populated for the
duration of the session.