Computer Science 111, Assignment 1
Tutorial on SSH, Pine email, and SFTPCopyright © 2001, 2002, 2004 by Dorothy L. Nixon. All rights reserved.
On your printout of this tutorial, write the name and E-mail addresses of your recitation/lab instructor below.
- Recitation/lab instructor's name:
- E-mail address for submission of homework:
- E-mail address for all other purposes:
The above information will be announced in lab.
(For Spring 2006 CS 111 E8QMA, the section which meets Mondays and Wednsdays at 9:00 PM, Dorothy Nixon's email address for submission of homework only is nixon@venus.cs.qc.edu.)
CONTENTS OF THIS TUTORIAL
- Preparing to log on remotely to a Unix system
- Logging on remotely to your Unix account via SSH
- The Pine E-mail program
- Replying to an E-mail message
- Sending a file attachment via E-mail
- Sending multiple file attachments
- Downloading and printing out your homework files
- Preparing to log on remotely to a Unix system.
If you are registered for Computer Science 111, you have been given an account on a machine called venus. You will not be logging on to that machine directly, but only remotely, from other machines, via either the campus network or the Internet.
There are two different kinds of programs you can use to log on to a remote machine over the Internet. The simpler and more traditional way is via Telnet. Another, better but more complicated way is via SSH (Secure Shell). Because there is a Telnet client program built in to Windows, you can use it immediately, without need to download or install it. However, the problem with Telnet is that is insecure. An intruder can easily spy on your Internet connection and find out your password. SSH makes spying more difficult by using encryption. But you will need to install an SSH client program on your machine at home. Becuase SSH is more secure, venus allows remote access only via SSH and not via Telnet.
To log on remotely, you will need an SSH (Secure Shell) client installed on your machine. On your machine at home, if you don't already have an SSH client installed, you can download a free SSH client at any of the following sites:
- PuTTY (download page)
- bitvise free SSH
- Free SSH and SCP for Windows 9x, NT, ME, 2000 and XP
- OpenSSH - lists various sources of free SSH clients.
Information about SSH can be found on the Resources page at freessh.org.
venus is a Unix system. That is to say, it is a computer whose operating system is Unix, not Windows. But you can log on to your Unix account remotely, over the Internet, from a personal computer with Windows, using your SSH client.
Make sure you know your user name and password on venus. For spring 2006 students, the username consists of eight chracters, as follows:
- First two letters of last name, lower case
- First two letters of first name, lower case
- Last four digits of student ID
Your preliminary password is your 9-digit student ID number (your Social Security number, in most cases). You should change it as soon as possible. Your new password should contain both letters and digits.
- Logging on remotely to your Unix account via SSH.
To log on remotely to your account, you will need to be sitting down at a machine with an Internet connection. If you are doing this at home, make sure you are connected to your Internet provider now. (If you don't have an Internet provider, get one ASAP!)
Below are instructions on how to use the SSH program that is installed on machines here at Queens College. The client you've downloaded onto your machine at home will probably differ from the following in its details, though it will be similar in function.
To use SSH, open your SSH client program from the Start menu, as follows: Click Start on the task bar, then click Programs, then click SSH Secure Shell, then click Secure Shell Client.
The first time you use SSH to log on to venus, click Quick Connect. A window will pop up. Next to "Host Name:", type:
venus.cs.qc.eduNext to "User Name:", type your user name. But do NOT type anything in the text fields next to "Port Number:" and "Authentication Method:", which should already contain the words "22" and "Password," respectively. Leave them alone.
Then click the Connect button on the pop-up window. If you are connecting to venus for the first time, a "Host Identification" dialog box will pop up. Click the "Yes" button. Then another dialog box will pop up asking for your password. Click on the text field next to the word "Password," then type your password in the text field and, then, either press [Enter] or click the "OK" button. As you enter your password. As you type your password, asterisks should appear in place of the characters you are typing. (If no asterisks appear, click on the text field and start typing your password again.)
You should now be logged on to venus.
Next, you might be prompted to change your password. (College policy on this will likely vary from semester to semester.) If you are told that your password has expired, don't panic. This just means you are being prompted to change your password. If you are prompted to change your password, do so.
If you are prompted to change your password, you will first be prompted to enter your old (current) password. Type it and press [Enter]. You will then be promted to enter your new password. Do so (by typing it and then pressing [Enter]). You'll then be prompted to enter the new password a second time. Do so.
If you are not automatically prompted to change your password, then type the following command:
passwdand press [Enter].
You will then be prompted to enter your old (current) password and then your new password twice, as discussed earlier.
Before you log out, you should first ask your SSH client to save the profile for this session, to make it simpler for you to log on next time. Click "Profiles" and then, in the resulting menu, select "Add Profile...." A small dialog box will pop up. In the text field at the left, replace "Profile name" by some appropriate phrase, such as the word "venus" followed by your user name. Then click "Add current connection to profiles".
Then log out by typing either:
exitorlogoutThen log in again, but, this time, click "Profiles" instead of "Quick connect." In the resulting menu, select the profile you just now created, with whatever name you gave it (e.g. "venus" followed by your user name, if you followed the suggestion above). The password window will now pop up immediately, and you won't have to type the host name or your user name again.
The second time you log on, you will not need to change your password again, as you did the first time.
- The Pine E-mail program.
Part of your first homework assignment will be to send E-mail to your lab/recitation instructor from your venus account.
On venus, you'll be allowed to send email only to other Venus accounts, not to other email accounts elsewhere. You'll need it to be able to submit homework to your lab instructor's venus account.
To send E-mail from venus, log on to venus again via SSH. Then, at the prompt, type:
pineYou have entered a program called Pine, which you will use to send E-mail. Since you are a new user, you will be offered some preliminary options. Type whatever you are asked to type to select whichever option you prefer. You should then see the main menu, which looks like the following:
? HELP - Get help using Pine C COMPOSE MESSAGE - Compose and send a message I FOLDER INDEX - View messages in current folder L FOLDER LIST - Select a folder to view A ADDRESS BOOK - Update address book S SETUP - Configure or update Pine Q QUIT - Exit the Pine program Copyright 1989-1994. PINE is a trademark of the University of Washington.Once you see the main menu above, enter your instructor's name and E-mail address in the address book, as follows: Press the letter A to bring up the address book. (For this purpose, it does not matter whether you type a capital or small letter.) Observe the menu at the bottom of the new screen that appears. From this menu, you will select items not by clicking the mouse, but by typing the indicated letters. For example, press A again to select Add; this will allow you to add a new name and address to the address book. You will see a prompt which says, "Enter new full name (Last, First):" At this prompt, type your instructor's last name and first name, separated by a comma, and then press [Enter]. You should then see a prompt which says, "Enter new nickname (one word and easy to remember)". Write any easy-to-remember word here; it is suggested that you use the word "instructor". After you press [Enter], you should see a prompt which says, "Enter new E-mail address:". Type your instructor's E-mail address here, making sure you spell it correctly, and press [Enter]. You will be told, "Addition complete. Address book updated." When you are finished, press M to go back to the Main menu.
You will now send an E-mail message to your instructor. First, press C for Compose message. You should now see the following near the top of your Telnet window:
To : Cc : Attchmnt: Subject : ----- Message Text -----On the "To:" line, type the nickname you are using for your instructor. Then, move the blinking-line cursor off the "To:" line, either by pressing [Enter] or by pressing the down-arrow () key. Your instructor's full name and E-mail address should appear. Move the cursor down to the "Subject: " line and type "Hello from" followed by your course number (CS 111) and section. Then move the cursor below "----- Message Text -----" and write a one- or two-line message introducing yourself. Please include the last 4 digits of your student ID number in the message. Then skip two lines and sign the message by typing your name.
Observe the menu at the bottom. One of the items is "^X Send." The "^" refers to the [Ctrl] key. To send the message you've just written, press [Ctrl]-X, i.e. type X while holding down the [Ctrl] key.
When you are finished using Pine, press Q to quit Pine; then type "logout" to disconnect from venus.
While waiting for your instructor's reply, please begin work on the Tutorial on Unix, vi, gcc, and elementary C++ syntax.
- Replying to an E-mail message.
A day or two later, log on again and check your E-mail and reply to your instructor's reply. Go into Pine by typing:
pineNow that you've already used Pine at least once, the main menu should appear immediately. From the main menu, press I to look at an Index of messages in your current folder, which is now the INBOX. You should see here a list of messages, of which one will be highlighted. To move the highlight if there is more than one message, use the up and down arrow keys. If there is a message from your instructor, move the highlight to that message, and press [Enter] to see the message. (If the message takes up more than one screen, press the spacebar to see the next screenful, and press the minus sign to go back to the previous screenful.)
Observe the menu at the bottom. In particular, observe "R Reply" As you may have guessed, this means you can reply to the message by pressing R. When you do so, Pine will ask, "Include original message in Reply?" Type Y for yes; this allows you to quote the original message in your reply, which usually a good idea so that the person you're replying to will remember what was being talked about.
You should now see a screen similar to what you saw when you composed a message, except that the "To:" and "Subject:" lines are already filled in, and the body of the message includes the quoted original. It is generally considered polite to edit the quote so it does not contain unnecessary lines. In particular, you should delete the person's signature and the blank lines immediately before it. Use the arrow keys to move the cursor down to the first of the lines you want to delete; and, as instructed by the menu at the bottom, press [Ctrl]-K to cut the line. (If you make a mistake and delete a line you wanted to keep, press [Ctrl]-U to uncut (restore) the line.)
Then, below the quoted text that you are keeping, type a brief answer and sign your name. Press [Ctrl]-X to send the message.
From now on, you should log on to venus at least once every couple of days, and preferably every day if possible, to check your E-mail. Keep this tutorial handy for future reference.
- Sending a file attachment via E-mail.
After you have completed Part 6 of the Tutorial on Unix, vi, gcc, and elementary C++ syntax. E-mail a copy of the file hello.cpp to your instructor, as a file attachment. Go into Pine and then begin either composing a new message to your instructor or replying to an old one. On the subject line, put your course number and section, and then "hello.cpp."
Then attach the file. Using the arrow keys, move the cursor to the "Attchmnt: " line of the message heading. Type [Ctrl]-T (holding down the [Ctrl] key on your keyboard, press T). Then, using the arrow keys, highlight your homework directory and select it by pressing [Enter]. Then, likewise, select the hw01 directory, and then the file hello.cpp.
Once you press [Enter] to select the file, the "Attchmnt:" line will change automatically, and should become something like this:
/usr/users/accountname/homework/hw01/hello.cpp (59 B) ""with your actual account name in place of "accountname," and with the actual length of the file in place of "(59 B)." The pathname, a complete absolute pathname starting at the root directory, has been generated automatically.
Using arrow keys, move the cursor to the empty quotes at the end ot the "Attchmnt:" line. In between the quotes, type the filename hello.cpp.
Then move the cursor down to the body of the message. Say anything you like in the body of the message, as long as it includes your name and the last 4 digits of your student ID. Then send the message.
When you try to send the message, you might get an error message saying "Problem with attachments! Send anyway?" If you see such an error message, type N for "No," and then go back to the "Attchmnt:" line and fix the pathname. (Most likely you misspelled the filename.) Then try to send the file again.
- Sending multiple file attachments.
After you have finished parts 7 to 14 of the Tutorial on Unix, vi, gcc, and elementary C++ syntax, prepare to submit the files you created or modified.
But before you send the files, please make sure your files all have the correct filenames. Make sure the filenames are spelled correctly, including lowercase vs. uppercase. You will lose points for incorrect filenames. If necessary, change any wrong filenames, e.g. by typing:
mv CelsiusToFahrenheit.cpp celciusToFahrenheit.cppThe mv command can be used either to change a filename or to move the file to a different directory. If you were using the mv command for the latter purpose, the last command-line argument would be a directoryname rather than a filename.
The files you'll be asked to submit are these: (1) averageOf3.cpp, (2) celsiusToFahrenheit.cpp, and (3) hypotenuse.cpp.
In your Pine email program, begin composing and email message whose subject line contains "CS 111," your section, and "Assignment 1." Use this one message to send all the files. To attach multiple files, move the cursor repeatedly to the "Attchmnt:" line, each time pressing [Ctrl]-T and selecting a file. For each file, please also type its filename within the empty quotes that appear after the pathname, so that your instructor can more easily recognize your files upon receiving them.
- Downloading and printing out your homework files.
You will now be taught how to use SFTP to download your homework files so that you can print them out. This SFTP tutorial is written on the assumption that you have completed the Tutorial on Unix, vi, gcc , and elementary C++ syntax and are now ready to download and print out the files you wrote or modified in that tutorial.
You have learned to log on to a Unix system over the Internet via SSH. You will now log on a different way, SFTP (Secute File Transfer Protocol), another Internet protocol which, as its name implies, allows you to copy files to and from a remote machine.
The instructions below will be exactly correct only for the SSH client program that we have on the machines here at Queens College. Other SSH/SFTP client programs will be similar in function, but different in detail.
From the Start menu, select Programs, then SSH Secure Shell, then Secure File Transfer Client. In the window that comes up, select "Quick connect" from the File menu, then long on as you did with SSH Secure Shell.
The window has two halves. The left half displays files and/or folders/directories on your local machine (the one you're sitting at), whereas the right half displays files and/or directories on the remote machine (in this case venus).
On the right side, select your directory homework, then hw01. On the left side, select the folder to which you'll be copying your files. To move up in the directory structure, right-click and select "Up."
Then, on the right side, right-click on one of the files you want to copy, and select "download." Copy each of the files this way.
Then log out by selection "disconnect" from the file menu.
Once you've downloaded all your files, you can use Wordpad to view them and print them out. (It is better to use Wordpad than Notepad, because Notepad has trouble with the line breaks in files that were created on a Unix system.)
To print this file, you can access the Print command in either of the following two ways: (1) Use the mouse to open the File menu and select Print. (2) Without using the mouse, press the [Alt] key, then f and then p. After that, you can access the remaining files by selecting Open from the file menu, then selecting a file. After selecting a file, print it. After you have printed all the files, close Notepad, either by clicking on the "X" button in the upper right corner or by selecting Exit from the file menu.
When finished, if you downloaded your files onto the hard drive of a machine at school, please delete them so that other students can't copy them.
After you have printed out all the files, staple together the printouts plus photocopies of the error messages you copied down in part 9 of the Tutorial on Unix, vi, gcc, and elementary C++ syntax. The printouts must be stapled together IN THE FOLLOWING ORDER: (1) averageOf3.cpp, (2) celsiusToFahrenheit.cpp, and (3) hypotenuse.cpp. At the back of the bundle of printouts should be your photocopies of your notes on the error messages.
Note for future reference: Later in the semester, you may need to remove old homework files from your Unix account, just to make sure you have enough disk space. Before you remove them, it is recommended that you download them onto a diskette, so you can keep a copy. And you should preferably download them onto more than one diskette, so you'll have duplicate copies, because diskettes are fragile.
Back to: