How do I restrict access on a web page in userpages.umbc.edu?

New userpages sites are no longer able to be created. If you are creating a website for class or instructional purposes, please use the Student Web Environment.

The following information is retained only for legacy purposes and is out of date.

Alert

This process is no longer supported by DoIT. However, it still may work.

Tell me

  1. Start an SSH session (Putty, TeraTermSSh, or Mac OS X Terminal utility).
  2. Log into gl.umbc.edu using the same username and password as myUMBC.
  3. At the prompt change the directory to your www directory
    Type:

    /afs/umbc.edu/users/<1st character of your myUMBC username>/<2nd character of your myUMBC username>/<your myUMBC username>/pub/www

    For example:
    username = jdoe1
    www directory path = /afs/umbc.edu/users/j/d/jdoe1/pub/www

    You can check what directory you are on by type 'pwd' which stands for print working directory.

  4. Navigate to the directory you want to restrict
    From the above example, type:

    cd images
  5. Type nano .htaccess
  6. Enter the following text:

    AuthName "Description of the login"
     AuthType Basic
     AuthUserFile .wwwusers
     require valid-user
  7. Hit CTRL+X to exit out of nano.
  8. Hit Y to save the changes.
    Please make sure the file is saved as .htaccess
  9. Create a list of valid users and the password to use.
    1. In order to have a directory password protected, you must create a set of usernames and passwords that are allowed. You should create a login for everyone you want to have access. To create the users, you first need to pick a file location. I used a file called .wwwusers in the same directory as my .htaccess file.
    2. To create the file that contains the allowed users, you will need to use a tool called htpasswd. If you just run it, it will give the syntax that it requires. Here is a basic example of creating a password file for a GL home page:

       linux1% cd ../pub/
       linux1% pwd
       /afs/umbc.edu/users/j/d/jdoe1/pub
       linux1% nano .htaccess
       linux1% htpasswd
       Usage: htpasswd [-c] passwordfile username
       The -c flag creates a new file.
       linux1% htpasswd -c /afs/umbc.edu/users/j/d/jdoe1/pub/.wwwusers guest
       Adding password for guest.
       New password:
       Re-type new password:
       linux1% ls -al .wwwusers
       -rw-r--r--    1 jdoe1      research      20 Jan  9 16:55 .wwwusers