|
This example restricts access to users
on two particular systems or hosts. This approach is
often useful if you want to restrict access
to workers in a small group and know the
the addresses of the desktop systems or
workstations they use. This example allows
access from the central Unix systems of
Hopper and Alberti but restricts access
from Christa. That probably does not make
logical sense, since someone normally has
an account on all three, but it allows you
to easily demonstrate that you understand how
the procedure works.
Here's the recipe:
- Create the .htaccess control file using
your editor of choice, e.g., pico.
Remember, Unix files that begin with a dot
are special and do not show up in normal listings
but require the "a" switch, as in:
% ls -al
OK, put the following in the 4-line .htaccess
file. Each line begins in column 1. Exact case
and spacing matter:
order deny,allow
deny from all
allow from 132.177.137.8
allow from 132.177.137.21
1st line indicates that deny directives come first,
followed by any allow directives.
2nd line indicates the default is to deny everyone.
3rd line makes an exception to allow access from
"132.177.137.8" which is the IP address for
hopper. That means anyone using Lynx on that
system would have access.
4th line makes an exception to allow access from
"132.177.137.21" which is the IP address for
alberti. That means anyone using Lynx on that
system would have access.
NOTE: IP addresses can be obtained by issuing the
UNIX command of the form:
% nslookup hopper.unh.edu
- Copy this file into the directory to be protected
and give it world-read access:
% chmode go+r .htaccess
% ls -al
- Test it to make sure it works. You should find it
works with Lynx if you login to Hopper and Alberti,
but not if you login to Christa.
Return to
start of discussion.
|