Meteorology 301 - Lab 2


Introduction

In this lab, you will create your Portfolio page from a template, make some modifications to it, and link it to your personal Web page. We will also see one way to restrict access to your Portfolio.

GOAL: Create your personal Portfolio page.


Instructions

1. Follow the instructions for accessing meteorology computers to log into your Meteorolgy account. If you are sharing a computer, each student should take turns doing these steps in her/his home space.

2. You need to copy the Portfolio template to your WWW space. It is stored in my Meteorology 301 directory. To ensure that you are in your home directory, enter
cd

3.Then copy the template from my directory into your WWW directory. Enter:
cp /mthome/gutowski/MT301/portfolio-template.html WWW/

4. Switch to your WWW directory:
cd WWW

There should be two files there (if you created a personal Meteorology web page). To see the files, enter
ls

One of the files in your WWW directory is "index.html". This contains your personal homepage. Another is the template file. The next step is to link the two. Lab 1 finished with an introduction to some basic unix/linux procedures. In particular, it introduced you to file editing and the "emacs" editor. We will use this editor to make changes in your homepage file telling it how to link to your portfolio file.

5. If your personal web page is located somewhere else, follow these instructions, but apply them to that page rather than the one used here. Edit the file index.html:
emacs index.html
You will see something that looks approximately like this:

[html]
[head]
	[title]
		ISU Meteorology home page for [username]
	[/title]
[/head]
[body bgcolor="#42426f" text="#ffffff" link="#ffff00" vlink="#93db70" alink="#cc3232"]
[h1 align=center]
	YourName's Meteorology Home Page
[/h1]

[p]

[hr size=3 width=80% noshade]

[p]
Here is some content that you could customize.
Note that even though this is just a boring paragraph,
you could use all the powerful features of HTML
including using images, fonts, lists etc.

[p]
This file was copied from a template at:[br]

[center][code]/mthome/gutowski/MT301/index.html[/code][/center]

[hr size=3 width=80% noshade]

[/body]
[/html]
There is a major difference between what you see here and what you see in the editor: all square braces ([]) here are angle braces (<>) in the editor window. The reason for this difference will be explained later, but for now, remember that anywhere you see [ or ] in these lab instructions, substitute < and >, respectively.

The entities like [head] are called tags and are part of a special document language used to create Web pages called HyperText Markup Language or HTML. These tags give instructions to an interpreter that produces the documents you see in the Web browser.

6. Simple emacs
Now we want to use emacs for making changes in your homepage file. The small square in the upper left corner that is shaded or tinted differently from the rest of the file is called the "cursor" and marks the point where the editor is currently located in the file.

  1. First, move the cursor. There are several options. The simplest is to use the arrow keys on your keyboard, which point in the direction they move the cursor when pressed.

    The Emacs Reference Card passed out to you gives an alternative way. To issue these commands, recall from the last lab that the "C" refers to the "control" key on the keyboard, and the "M" refers to the "Meta" key. This is usually the "esc" key on a keyboard. The "C" or "M" key is held down while pressing the second key in the command, e.g., "C-b" means hold down the "control" key and, continuing to hold it down, press the "b" key.
  2. Move the cursor down about halfway, below the line that says
    [hr size=3 width=80% noshade]
    
    We want to add a line that says "Go to my meteorology student portfolio." with the last words forming a link that will connect the browser to the portfolio page.

    Type in the following, except make two substitutions:

    Go to my [a href="http://www.meteor.iastate.edu/~LOGNAME/portfolio-template.html"] meteorology student portfolio.[/a]

  3. Then close the file, entering
    C-x C-c
    and answering y (for yes) to the question
    Save file /home/LOGNAME/WWW/index.html? (y, n, !, ., q, C-r or C-h)
    

7. Portfolio page
Now that the link to the portfolio page has been established, you should next start to personalize it.

  1. Edit the file portfolio-template.html:
    emacs portfolio-template.html

  2. Move the cursor down a few lines to the one that includes "Your Q. Name".
  3. Move the cursor right until it is on top of the "Y".
  4. Erase the words "Your Q. Name" by entering
    C-d
    repeatedly until only the HTML tags that surrounded it are left.
  5. Place the cursor on the "<" of the [/h1] tag and then type your own name.
  6. Exit the file:
    C-x C-c

Completing these steps successfully completes what you need to do for the lab. I will check on your progress using the URL you sent me from Lab 1 and using the link you established between your home page and portfolio page.

{NOTE for 1998 and beyond: Step 8 below is not effective, so you do not do it. However, subsequent steps do give useful information for protecting standard, non-Web files on Vincent and other unix environments, so it's a good idea to read Steps 9 & 10.

You should read Step 11 in any case.}

8. Finally, we will take a series of steps so that only a select number of people can read your portfolio page, thus keeping it somewhat private. I'll give you the commands to enter, then an explanation you can read afterward.

While still in the WWW subdirectory, and remembering that here LOGNAME = your Vincent login name in lower case, enter
chlist -a gutowski LOGNAME
chmod o-rw portfolios-template.html
chmod g+r-w portfolios-template.html

9.Short explanation:
These three commands ensure that I can look at your portfolio file, but that the general public can not. They also ensure that only you can make changes to it.

10.Long explanation:
Every file on a UNIX system has three access categories:

You can select who is in your group and what types of access user, group, and other each have.

There are three types of access:

  1. Group control:

    You control who is in your group through the "chlist" command. Perhaps the three most common uses of the command are

         command                           effect
    ---------------------------      ---------------------------------------
    chlist -m LOGNAME                Lists LOGNAME's group members
    chlist -a othername LOGNAME      Add "othername" to LOGNAME's group
    chlist -d othername LOGNAME      Delete "othername" from LOGNAME's group
    
    Here, "othername" is someone else's Vincent login name.

  2. Access control:

    Each type of access can be turned on or off using the "chmod" command. Whenever a new file is created, default access types are given to each of the user, group, and other categories. Usually, the defaults are

    category           access
    --------         ------------
    user             read + write
    group            read only
    other            read only
    
    though defaults can vary with machine and the user can set the defaults.

    These examples show how access for each category can be changed:

         command                           effect
    ---------------------------      ---------------------------------------
    chmod g+w filename               give the group write access to filename
    
    chmod o-rw filename              remove both read and write access for 
                                     the general public to filename
    
    chmod u-x filename               remove user's (owner's) execute access 
                                     to filename
    
    chmod g+r-w filename             give the group read access, but remove
                                     write access
    

    You can check a file's access types for each category using the "ls -l" command. Entering
    ls -l filename
    returns this information. For example, I have a file called "test.html". Entering
    ls -l test.html
    returns

    -rw-r--r--  1 gutowski      392 Jan 20 15:16 test.html
    
    The set of 10 characters "-rw-r--r--" gives the information. The first "-" does not concern us here. The remaining 9 characters are in three sets of 3. Within each set, the three characters tell whether read, write, and execute access are on or off. A "-" means the access is off. The first set refers to user (owner) access, the second set to group access, and the third set to access by others. In this example,

    Thus, the commands I gave you in step 8. (1) made me a member of your group, (2) removed read and write access by the general public to your portfolio file, and (3) ensured that your group has read access (but not write access) to your portfolio file.

    11. Why the "[" and "]" instead of "<" and ">":
    These instructions have been written to appear as a Web page. The browser interprets any HTML tags it finds and uses them to create the Web page on your screen. Even the example tags will get interpreted, so in order to have them appear on the page, they need to be altered so that they are not formally tags anymore.


    Return to Meteorology 301 Lab List

    Return to Meteorology 301 Homepage