SWE 642 Creating a Web Page on Mason

Aug 2009

All GMU students have an account on mason.gmu.edu, and can create small websites. Space is limited.

Following is a simple list of commands that will help you create a simple web page. Use these commands after logging on to mason.gmu.edu (the same account and password as your gmu email account).

Your URL will be: http://mason.gmu.edu/~username/

Instructions for creating a password protected directory in Apache.

These instructions are based on the Authentication, Authorization, and Access Control tutorial. You can also get more help from the Free Webmaster Help. You can see an example using this in my mason account. You should see something like the following:


If you are not familiar with Unix commands, it is important to follow these instructions precisely. To password-protect a directory in the Apache web server, you must create a directory, give it the appropriate permissions, create the file .htaccess with the correct permissions and contents, and create a password file. We are going to name the directory testaccess, and the password file users. Start from within your public_html directory (or another directory in your website).

Before starting, find out which disk partition your home directory is on. After logging on to mason.gmu.edu, enter the command "pwd". You should see something like "/home/u3/USERNAME". "u3" is the disk partition; yours might be u2, u4, u5, or something similar. Use that partition in the command below ...

  1. mkdir testaccess
  2. chmod 711 testaccess
  3. cd testaccess
  4. create .htaccess with the following contents:
    AuthType Basic
    AuthUserFile /home/u3/USERNAME/public_html/testaccess/users // Replace "u3" with whatever you got from the pwd command
    AuthName "642 homeworks"
    require user swe642
    You can create this file using "vi", "pico", or any other editor on mason. Or you can create it on your local computer and upload it via sftp. Make sure it is in the right place!

    Your file should replace USERNAME with your user name. You must include the user swe642.

  5. chmod 644 .htaccess
  6. Create the password file and add the user swe642 with a password:
    /usr/apache/bin/htpasswd -c users swe642
    The option "-c" will create the file and the program will prompt you for a password for "swe642".
  7. chmod 644 users
  8. Create an index.html file in the testaccess directory. You can create it with a Unix editor or create it on your computer and use sftp to copy it up.
  9. chmod 644 index.html
  10. Test through a browser by trying to access the directory: http://mason.gmu.edu/~USERNAME/testaccess/