--> --> Protecting Access to a Web Page by IP address -->

Protecting Access to a Web Page by IP address

The method in this document is best if you only want specific machines to be able to access the documents on your site.

  1. Change into your pub directory:
    cd ~/../pub
  2. Create a directory for your password protected web page.
    mkdir private
    (You can use whatever directory name you like; we have used the name private)
  3. Change the AFS permissions on the directory that you created with the commands:

    fs sa private/ system:anyuser none system:httpd read

    This will give the web server read permissions and remove the world read permissions that your pub directory has by default.
  4. Change into the directory you just created.
    cd private
  5. Create a text file called .htaccess containing the following (you might type pico .htaccess to begin creating the file):

    AuthType Basic
    order deny,allow
    deny from all
    allow from <ip-address>
    satisfy any


    (Replace ip-address with the ip address of the computer you want to give access to. If you used pico to create the file, save it using control-O, press return, and then use control-X to exit. If you want to allow multiple users to access the page, put additional allow from <ip-address> lines in the .htaccess file, one for each ip address or use wildcards for ranges of ips i.e. 129.2 .)

That's it! Now, just put the web page you'd like to protect into the private directory. To access the page, point your web browser to:

http://www.wam.umd.edu/~yourusername/private/filename.html

(Where filename.html is the name of your password-protected web page, and yourusername is your WAM login ID.)

Also note that you can mix this with user restricted access found at here.

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site