Mathematics Logo

Creating Your Home Site

The math department allows you to host a personal professional website on our server. The url for your site is math.mit.edu/~your_username.

Once you have obtained a math account, you can connect to the server via secure protocols (SSH, SFTP, SCP) with your math username and password. You may use any of the login servers as the host:

  • laurent.mit.edu
  • lebesgue.mit.edu
  • runge.mit.edu

Once you are connected, you will find your home directory at /math/home/your_username.

To create your website, you must add a publicly accessible directory named www to your home directory. Any files with the correct permissions (755 for directories, 644 for files) within this directory can then be viewed on your website. If no file is specified in the url, the server will automatically look for a file called 'index.hml' or 'index.php.' See below for more detailed instructions.

Once your website is setup, you can include it in your directory listing on the math website. Visit the Profile Manager to update this and other profile information.

Setting Up Your Website

For HTML, CSS and other web tutorials, visit W3schools.com.

Editing in the Terminal

Open a terminal window and use these commands to set up and edit your website.

  1. ssh username@hostname Connect to the server, substitute username for your usename and hostname for one of the hosts listed above. You will be prompted to enter your password.
  2. mkdir www Create a directory, this will house your website
  3. chmod 755 www Assign correct permissions to your web directory
  4. chmod 755 . Assign correct permissions to your home directory
  5. Create your homepage file
    • Create a file using a text editor (see text editors under Workstations)
    • Add your homepage content to the file.
    • Save this file as index.html.
    • chmod 644 index.html Assign correct permissions to your homepage file

Transfering Local Files to the Server

To create your website files, you can either work with an editor on the server, as above, or you can create files on your local computer and transfer them to the server via SFTP or SCP.

SFTP: Follow steps 1-4 above and replace ssh in step 1 with sftp. You can then transfer files with the get and put commands as described in this tutorial: SFTP Tutorial

SCP: After following steps 1-4 above, close the connection to the server (command: exit). You can then transfer files via SCP as described in this tutorial: SCP Syntax

Setting Up Your Web Directory with a Graphical Interface

If you are unfamiliar with the terminal, you can download a graphical interface* to help you set up your web directory. Suggested free applications for this purpose are Cyberduck and Filezilla.

Each graphical interface will be slightly different to use but have the same general steps. See your application's documentation for more specific instructions.

  1. Create a connection to the server with the credentials:
    • User: your math username
    • Password: your math password
    • Hostname: laurent.mit.edu, lebesgue.mit.edu, or runge.mit.edu
  2. Navigate to your home directory /math/home/your_username (You will likely already be there)
  3. Create a directory called www
  4. Ensure www and your home directory have public execute permissions (755 or rwxr-xr-x)
  5. Add your webfiles to www, use the filename index.html for your homepage file.
  6. Ensure your files have public read permissions (644 or rw-r--r--)

*Note: Whatever system you use MUST support secure protocols (SFTP, not FTP).

CGI Programs

If you wish to add additional functionality to your site you may want to install some CGI programs. In order to add a CGI program, take the following steps:

  1. In your www directory, create a directory named cgi-bin
  2. Change the permissions of that directory so it is executable by others (755).
  3. Put any CGI programs you'd like to run from your web site in the cgi-bin directory, ensuring they are executable by others and have the suffix .cgi

If you are having trouble getting a CGI program to execute, ensure that permissions on the files and parent directories are not too permissive and are owned by you. There is a security mechanism in place that prevents the program from being run if these conditions are not met.

Please note that while we provide the means for you to use CGI programs, we cannot provide any support in installing or configuring them.

How to set up a protected web page:

  1. Make a file called .htaccess and place it inside the directory you would like to keep private.
  2. Add the following lines to the .htaccess file:
    AuthName "Protected Page"
    AuthType Basic
    AuthUserFile /math/home/username/.htpasswd (change this to reflect your own directory)
    require valid-user
    • AuthName is the title of the authentication box. This can be changed to give a short description of the protected page.
    • AuthType is how users autenticate. This does not need to be changed.
    • AuthUserFile tells .htaccess where to find password file. ~user/ path name's will not work.
    • require vaild-user only lets user names listed in AuthUserFile to have access.
  3. Create a file called .htpasswd in the directory where .htaccess is looking to find it (/math/home/username/.htpasswd in the above example). This file contains usernames and password of allowed users, one per line. As a rule of thumb, this file should not reside in the same directory as your protected page. The passwords in this file are hashed for security so the file would look something like this:

    user:ab4F9023jvs
    anotheruser:3jsjHee043sb
    threeusers:02js9JsJJs3

    To acquire these hashes, use the command htpasswd -nb user password in the terminal and the hash will be returned. Alternatively, you can use a htpasswd generator such as this: www.htaccesstools.com/htpasswd-generator/

Any questions about setting up your website can be directed to webmaster@math.mit.edu