The File Transfer Protocol (FTP) Utility

From the last chapter, you know that File Transfer Protocol (FTP) is a subset of TCP/IP and that FTP is used during the transfer of files between Unix boxes. In recent years, FTP has become a truly cross-platform protocol for file transfer. Because Internet, and thus TCP/IP, use has skyrocketed, almost every client (and server) platform has implemented FTP. Windows 95/98 and NT are not exceptions. Both of their TCP/IP stacks come with a command-line FTP utility (as a matter of fact, they’re basically the same utility).

To start the FTP utility, type FTP at a command prompt. The result is an FTP command prompt:

FTP> 

From this command prompt, you can upload and download files, as well as change the way FTP operates. To display a list of all the commands you can use at the FTP command prompt, type HELP and press Enter. To get help on a specific command, type HELP, a space, and then the name of the command.

The Network+ exam doesn’t ask specific details about how to upload and download files using FTP. You primarily need to know what the protocol is and does. You will get a brief introduction to uploading and downloading files in this section, however, because every network technician and administrator needs to know how to do this. As they come up, the specific commands necessary to perform those two operations will be discussed, as well as commands that relate to those processes. But first, let’s look at how to start the process.

Starting FTP and Logging In to an FTP Server

Of the two FTP file operations (download and upload), the ability to download files is the more important skill for a network technician or administrator to master, because network and client operating system drivers and patches are located on FTP servers throughout the Internet.

The first steps in starting an FTP download session are to determine the address of the FTP site and start the FTP utility. The FTP site typically has the same name as the website, except that the first three characters are FTP instead of WWW. For example, Novell Inc.’s website is www.novell.com. Its FTP site, on the other hand, is ftp.novell.com. We’ll use this FTP site as an example for the rest of this section.

First, start the FTP utility as discussed earlier, and then follow these steps:

  1. At the FTP command prompt, type open, a space, and the name of the FTP server. For example:

FTP> open ftp.novell.com  
Tip 

You can also start an FTP session by typing FTP, a space, and the address of the FTP server (for example, FTP ftp.novell.com). This allows you to start the FTP utility and open a connection in one step.

If the FTP server is available and running, you will receive a response welcoming you to the server and asking you for a username:

ftp> open ftp.novell.com  Connected to ftp.novell.com.  220 nemesis FTP server ready.  User (ftp.novell.com:(none)): 
  1. Enter a valid username and press Enter.

Note 

Most Internet web servers that allow just about anyone to download files also allow the username “anonymous.” Remember to type the username exactly and to double-check as you enter it because usernames are case sensitive. In addition to “anonymous,” you can use the username “ftp” to gain access to a public FTP server. They are both anonymous usernames. Remember that FTP (and Unix) usernames are case sensitive.

  1. Enter your password and press Enter.

If you are accessing a private FTP server, you should use the username and password given to you by the administrator. If you are accessing a public FTP server with a username such as anonymous, you can use your e-mail address as the password.

Tip 

You don’t have to enter your entire e-mail address to log in with the anonymous username. Most FTP server software doesn’t verify the actual e-mail address, just that it is, in fact, an e-mail address. To do this, it checks for an @ sign and two words separated by a period. You just need to enter a very short e-mail address to bypass the password (like u@me.com). This is especially helpful if you have a long e-mail address. It’s also more secure if you don’t want lots of junk e-mail.

If you enter the wrong username and/or password, the server will tell you so by displaying the following and leaving you at the FTP command prompt:

530 Login Incorrect  Login failed.  

You must now start over with the login process. If you are successful, the FTP server will welcome you and drop you back at the FTP command prompt. You’re now ready to start uploading or downloading files.

Downloading Files

After you log in to the FTP server, you’ll navigate to the directory that contains the files you want. Thankfully, the FTP command-line interface is similar to the DOS command-line interface. This is no surprise since DOS is based on Unix, and FTP is a Unix utility. Table 4.3 lists and describes the common navigation commands for FTP. Remember that these are also case sensitive.

Table 4.3: Common FTP Navigation Commands

Command

Description

ls

Short for list, this command displays a directory listing. Very similar to the DIR command in MS-DOS.

cd

Short for change directory, this command works almost identically to the MS-DOS CD command. Use it to change to a different directory and navigate the server’s directory structure.

pwd

Short for print working directory, this command displays the current directory on the server. Useful if you forget where you are when changing to several locations on the server.

lcd

Short for local change directory, this command displays and changes the current directory on the local machine. Useful when you are downloading a file and aren’t in the directory where you want to put the file.

After you navigate to the directory and find the file you want to download, you must set the parameters for the type of file. Files come in two types:

  • ASCII, which contains text

  • Binary, which is all other files

If you set FTP to the wrong type, the file you download will contain gibberish. When in doubt, set FTP to download files as binary files.

To set the file type to ASCII, type ASCII at the FTP command prompt. FTP will respond by telling you that the file type has been set to A (ASCII):

FTP> ASCII  Type set to A 

To set the file type to binary, type binary at the FTP command prompt. FTP will respond by telling you that the file type has been set to I (binary):

FTP> binary  Type set to I 

To download the file, you use the get command, like so:

FTP> get scrsav.exe  200 PORT command successful.  150 Opening BINARY mode data connection for 'scrsav.exe'     (567018 bytes). 

The file will start downloading to your hard drive. Unfortunately, with its default settings, the FTP utility doesn’t give you any indication of the progress of the transfer. When the file has downloaded, the FTP utility will display the following message and return you to the FTP command prompt:

226 Transfer complete.  567018 bytes received in 116.27 seconds (4.88 Kbytes/sec) 
Tip 

You can download multiple files by using the mget command. Simply type mget, a space, and then a wildcard that specifies the files you want to get. For example, to download all the text files in a directory, type mget *.txt.

Uploading Files

To upload a file to an FTP server, you must have rights on that server. These rights are assigned on a directory-by-directory basis. To upload a file, log in and then follow these steps:

  1. At the FTP command prompt, type lcd to navigate to the directory on the local machine where the file resides.

  2. Type cd to navigate to the destination directory.

  3. Set the file type to ASCII or binary.

  4. Use the put command to upload the file.

The syntax of the put command is:

FTP> put <local file> <destination file> 

For example, if you want to upload a file that is called 1.txt on the local server, but you want it to be called my.txt on the destination server, use the following command:

FTP> put 1.txt my.txt 

You’ll see the following response:

200 PORT command successful.  150 Opening BINARY mode data connection for collwin.zip  226 Transfer complete.  743622 bytes sent in 0.55 seconds (1352.04 Kbytes/sec) 
Tip 

You can upload multiple files using the mput command. Simply type mput, a space, and then a wildcard that specifies the files. For example, to upload all the text files in a directory, type mput *.txt.

When you’re finished with the FTP utility, simply type quit to return to the command prompt.




Network+ Study Guide
Network+ Study Guide
ISBN: 470427477
EAN: N/A
Year: 2002
Pages: 151

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net