UB Information Technology

Directory Domain Restriction

This should help you set up protection on a directory in UBWings. It is adapted from the NCSA Mosaic User Authentication Tutorial for UBWings Information Providers.

The example below shows you how to set up access restrictions to a directory based on the domain that your visitors are coming from (in other words, you can use it to "lock out" non-UB computers).

There are several simple steps:

  1. Where is your directory and what is it called?

    Log in to your Unix account and go to your departmental directory on Wings (e.g. type cd /net/wings/info/www/whereveryourdirectoryis). Find the name of your Unix subdirectory by typing:

    pwd

    This will return the "present working directory" - we'll call it "home" from now on when we need to reference it.

  2. Create a new subdirectory off your home directory by typing: mkdir xxxxx (where xxxxx is the name for your new directory)

    This new direcory is /home/xxxxx and will hold the files you wish to protect.

  3. Move into the new directory xxxxx: cd xxxxx

  4. This seems to be the most difficult part. Follow the instructions and you will have no problems.

    Create a file called .htaccess in directory xxxxx that looks like this:


    order mutual-failure
    allow from .buffalo.edu
    deny from freenet.buffalo.edu

    Save it and exit the editor. OK, .htaccess is done!

  5. Set the directory permissions. At the Unix prompt, type:

    chmod a+rx /home/xxxxx
    chmod a+r /home/xxxxx/.htaccess

That's all. Now put some files in the directory /home/xxxxx/ and try to access them -- your browser should show the files if your computer's domain is .buffalo.edu. If possible, have a friend from outside UB try to access the files.

> Wings Overview
> Wings IP Guide