California State University, Sacramento

Home
Syllabus
Assignments
Contact
Grades

Assignment 8

Points: 30
Due Date: 4/3
Reading: Tutorial 6 sessions 6.1, 6.2, 6.3




Introduction:

Ftp (File Transfer Protocol) is a limited form of remote login, that allows the transfer of files between two computers on a network. Ftp is implemented as part of the TCP/IP protocol suite mentioned in lab 5.

Questions from the reading:

  1. What are the three ways ftp can be run?

  2. Can a UNIX operating system talk to a Windows operating system using FTP? Why or why not?

  3. There are two ways to access an ftp server. List and explain the differences between the two.

  4. What ftp transfer mode would you use to transfer an html document?

  5. What ftp transfer mode would you use to transfer an image?

  6. Why is compression commonly used when using FTP?

  7. What is the difference between freeware and shareware?

Ftp on gaia:

Our class account's host gaia, has a working ftp server that allows both types of access. We'll begin by using the command line version of an ftp client. You will need to open a telnet session on gaia, or a DOS window if you are using Microsoft Windows to follow the directions below. (Your textbook describes command-line ftp on pages 6.37 - 6.40.)

From this point, the instructions are the same:

  • Type ftp -- you will be presented with the ftp> prompt.

  • Type open -- your ftp software will respond with (to)

  • Type the hostname: gaia.csus.edu (note: You need to do this even if you logged into gaia from home using telnet. We are creating a new session to ftp except now your ftp client and the ftp server you are connecting to are on the same machine. If you are doing this directly from a DOS box at home, your ftp client is on your local machine.)

  • You should now be prompted for a username. Use your class account login name and password to log in.

By the way, most ftp servers enforce an idle timeout, and in gaia's case it is 900 seconds. If you find yourself logged out because you have been idle for too long, just log back in.

You will find that many of the familiar Unix shell commands are supported by ftp. Type help for a list of these commands (You can then type help [command] for information on a particular command).

  1. List the two commands that you would use to change between ASCII and binary mode.

  2. Type dir at your ftp prompt. Is this listing the same as the Unix long listing?

Later, when you are working on your web page files, you can transfer them to your local computer and work on them while offline. Your web page files are located in a subdirectory of your main directory. Use the ftp command cd html to change to this directory.

  1. Do a listing, and tell me the names of all files in the html directory.

Transferring Files:

ASCII is an acronym for the American Standard Code for Information Interchange, which is a standard code for characters. The reason that we transfer text files separate from all other files (images, programs, data files, etc.), is because of the way that end-of-lines are handled on different machines like PC or Unix computers. How do you know if a file is text or binary? Most of the time you can tell by the file extension: .zip, .gz, .tar (archives), .exe (programs), .jpg, .gif, .bmp (images) are all examples of binary files. If you aren't sure, type cat [filename] at the Unix prompt, or open the file in Windows Notepad. If you can read it and there are no unintelligible characters, it's a text file.

Log out of your current ftp session by typing quit. Now you'll ftp to ftp.cdrom.com, but instead log in anonymously. Log in as "anonymous" and use your e-mail address as the password.

Once logged again do a listing. You should see two folders: locked and pub. As an anonymous user, you are restricted to this area of the server. Traverse the directory structure by changing to the pub directory, and then the gutenberg directory. There is a file called "sawyr10.txt", in a directory called "etext93". Download (get sawyr10.txt) this file, then quit your ftp session. Type the command more sawyr10.txt to read the file.

  1. List all the commands required to change to the appropriate directory and retrieve the file.

  2. What does this file contain?

Graphical ftp

Of course, the command line version of an ftp client is not as user-friendly as one that runs in a graphical environment like Windows. For this reason, we will do some file transfers that utilize a graphical ftp application. These allow you to select options and files in a dialog box, then click a button to start the transfer.

There are several popular graphical ftp clients, but unless you have specifically downloaded and installed one you probably won't have one. For this reason, I am providing the links below.

WS_FTP LE ( PC )
Fetch Softworks ( MAC )

You can also find many good resources online; one of my favorites is Tucows. There you will find links to a massive amount of Internet software and other stuff, including ftp client software.

After you have your client installed and running, connect to gaia.csus.edu, using your class account name and password.

Once connected, you can change directories, and navigate through the file systems in the same manner as your local explorer or finder. Change again to your account's html directory, and transfer (get) the file index.html. Make sure that you select ascii mode (text) as the transfer mode.

Now that you have the index.html file on your home computer, take a look at it in your favorite text editor.

  1. What does the html source file say is the URL of your account's web page?

You will be able to transfer files this way between your local machine and gaia, so that you can edit them offline and upload them when you are done. Most people find the graphical client is easier to use than the command line, but you never know when one might be more handy.

Other anonymous logins:

You can also use your web browser as an anonymous ftp client, using the ftp:// protocol in the URL. For example, try this link: ftp://gaia.csus.edu

A new browser window should have opened, with the same ftp directories listed as when ftp'ing in anonymously using the command line interface. Notice the URL in the address window: it has the FTP protocol listed, and not the HTTP protocol.

Generally, a public ftp server will put downloads in a "pub" directory for you to access. You may have notice that gaia has one too.

A couple of anonymous ftp sites I find useful are:

  • wuarchive.wustl.edu
  • sunsite.unc.edu

Both are great archive sites with a lot of useful stuff. The wuarchive site has a lot of images that you can download, especially good if you are looking for stuff for your web page.

Using whatever ftp client you like, ftp to sunsite.unc.edu and log in anonymously. There is a file called graham-crack in the /pub/docs/recipes/usenet-recipes/ directory. Transfer this file to your local machine and take a look at it with a text editor.

  1. Who posted this recipe?

You can now log out of this ftp session.

One of the benefits of using your web browser and an anonymous ftp client is that you can access other things, like images, in the same application. ftp://wuarchive.wustl.edu/, will connect you to the ftp server at the University of Washington at St. Louis. Note the "ftp" in the URL, instead of "http".

Browse to the /multimedia/images directory. Here you will see directories for jpg and gif images. This is a great place to get pictures, and using your web browser is a great way to preview them. To save an image, you should be able to right-click it and select "Save As...", or simply double click it.

  1. What year is the mustang in the mustang.gif file?

A Note about Compressed files

Often files you download over the Internet are compressed -- that is, they have been encoded so that they take up less space. This is advantageous, because they require less storage space on the server, and take less time to download.

You can recognize compressed files by their names. Files with the extensions .gz, .gzip, .zip, and .Z are compressed. In compressed form however, they can not be used. To get the data into a usable form, you must decompress, or expand the file. This requires a separate utility on your local computer. Other files, most notably images in .gif and .jpg format, are compressed, but are decompressed by the image viewer program (a web browser, for example). A newer trend is to use a self-extracting executable. These files still have compressed data in them, but the data is distributed along with a program to extract and install the compressed program. In a Windows environment, executable programs have the extension .exe

You can find many programs available to uncompress files at the tucows web site mentioned above.