Using The File Transfer Protocol (FTP) Networking

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 the Internet, and thus TCP/IP, use has skyrocketed, almost every client (and server) platform has implementedFTP. Windows is no exception. Its TCP/IP stack comes with a command-line ftp utility.

To start the ftp utility, enter ftp at a command prompt. The result is an ftp command prompt:

ftp>

From this command prompt, you can open a connection to an FTP server and 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 or ? and press Enter. To get help on a specific command, type help, a space, and then the name of the command.

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, Microsoft’s website is www.microsoft.com. Its FTP site, on the other hand, is ftp.microsoft.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 as in the following example:
    ftp>open ftp.microsoft.com 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.microsoft.com Connected to ftp.microsoft.com.
    220 Microsoft FTP Service
    User (ftp.microsoft.com:(none)):
  2. Enter a valid username and press Enter.
  3. 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.

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 common navigation commands for FTP are also case sensitive.

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.

common-ftp navigation commands

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)

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 as follows:

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)

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


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Networking Topics