The File Transfer Protocol (FTP)

Posted by arlene

FTP is used to transfer files between computers. It is a complex protocol that enables the exchange of data files using different methods of data representation and file storage. In its simplest form, FTP uses clear-text username and password exchanges and is not considered to be a very secure utility. FTP was originally created when the Internet was still composed mostly of large business, government, and educational institutions, and a breach of security wasn’t considered that big of a threat. When used on the Internet, however, most every legacy TCP/IP utility is best used in a secure environment. The commands in this chapter show you how to use FTP. To ensure a secure exchange of information, be sure to read the chapters in Part VIII, “System and Network Security.”

The syntax for FTP varies from one vendor’s implementation to another. However, the simplest format, used to initiate a connection, is

ftp hostname

in which you simply follow the ftp command with a hostname—for example, ftp ftp.archive.org. You also can use the dotted-decimal address instead of the DNS name of the system with which you want to establish a connection. Alternatively, you can enter ftp at the command prompt and then, from the f tp> prompt, enter the commands needed to accomplish a particular task.

A lot has changed in the past 20 to 30 years. More secure forms of authentication and data exchange have been added to create more secure forms of FTP. Before we look at a few common FTP clients and their syntaxes, let’s look at the basic FTP protocol and get a feel for how it works.

FTP is based on a client/server architecture. An FTP server (called a daemon on Unix or Linux systems and a service on Windows systems) manages a file system (anything from a single directory to a disk farm). FTP servers authenticate the client user using a username and password, and then work with the client to transfer files between the client and server computers. The basic protocol is a simple exchange of messages. Traditional FTP uses a simple command-line interface. Today, many shareware and commercial GUI versions of FTP are available. For example, if you are already using a favorite FTP site, try using a URL such as ftp://ftp.archive.org to see whether your browser supports a GUI interface for FTP. Either way, command line or GUI, it is an extremely useful utility because it allows the transfer of many types of files between two hosts on the network.

Living the Web 2.0

FTP Ports and Processes

The FTP server daemon listens in the background for FTP requests on TCP port 21. In the literature, the server is composed of two components, though they are often combined into a single program. The first is the Server-PI, which stands for “server protocol interpreter.” This is the component that listens to TCP port 21 and interacts with its client counterpart, the User-PI. The user protocol interpreter initiates an FTP session by sending a request to the server. The client’s request can include a port that the client wants the server to use when it opens a data channel.

The second component of the server is the Server-DTP, which stands for “server data transfer process.” This is the code that interacts with its counterpart, the User-DTP, to perform the actual file data transfers. The important thing to notice that two channels of communication are used for FTP—one for commands and one for the actual exchange of data—and that both of these channels work in both directions.

Data Transfers

All FTP data transfers take place using bytes (8 bits), independent of the size of the actual data being transferred. That is, if the local file system uses a different size for storage, such as a word or a floating-point numerical representation, FTP just sends 8 bits at a time. The data is reconstructed on the receiving end into its original format. The client and server applications are responsible for making sure that conversions are done on their end to make data usable on their respective systems.

When you’re using an FTP client, it is important that you know what type of file you are sending or receiving. The default for most clients is to send/receive ASCII text files. If you want to send or receive an executable program, most clients use the command “binary” to inform the server you interact with that this is not an ASCII text file.

Additionally, there are three modes that are used for transfers:

  • Compressed mode—In this mode, data can be sent using various compression mechanisms.

All transfers are done in 8-bit bytes, regardless of the way the bits are interpreted on the receiving system. The data types that FTP allows are very basic. The ASCII type consists of standard 8-bit NVTASCII characters. In this format, the carriage-return and line-feed characters are used to indicate the end of a line. Some systems, such as many Unix systems, do not use this combination of characters, and the receiving side converts the received stream of bytes to its own format.

The EBCDIC type (Extended Binary-Coded Decimal Interchange Code) is a method of character representation used mainly on IBM mainframe computers, which were quite popular back when development on FTP (and its predecessors) first started. The EBCDIC and ASCII transfers are sent as 8-bit characters and are similar, with just the character representations of the numerical values differing.

The IMAGE mode of transfer sends data as a simple stream of bits, which are stored in the usual 8-bit transfer byte used by FTP. At the receiving end, the bits are stored in a contiguous manner, with padding added to the end of a file or record as necessary. The method used must ensure that the process of this padding can be reversed if the file is transferred to another system that does not use that method.

The LOCAL type allows the user to set a logical size for the bytes to be sent. All data is still sent as a byte, but on the receiving end this command allows the receiver to know how to reassemble the bits into the correctly sized bytes for that operating system.

FTP Protocol Commands

This section looks at some of the more useful commands that the protocol uses to control an FTP session. This is not an exhaustive discussion of all possible protocol commands, however. The next section looks at examples of the syntax for FTP for several implementations so that you can see how various FTP applications work, and how their command structure matches up user commands to the commands actually used by the FTP protocol processes.

Note that these “protocol commands” are the commands exchanged by client and server applications on the network. Commands entered by an end user are a different matter altogether. Many end-user commands involve a sequence of protocol commands to accomplish the desired function. Here we examine the commands exchanged between the server and client applications, not the command entered by a user.

FTP protocol commands start with the command code itself and are usually followed by one or more arguments. All FTP protocol commands are four characters or fewer and can be grouped into a few categories:

Possibly related posts: (automatically generated)
The File Transfer Protocol (FTP)

2 Responses to “The File Transfer Protocol (FTP)”

  1. &quotas part of our commitment to provide our customers and the public with affordable web presence, we are proud to simplify low cost .Info domain registration.” said Ivan Vacuously, Chief Executive Officer of … … Web Hosts

  2. 60 help students to develop the strong keyboarding skills they need and combine them with the functions of Word 2000, word processing software. … Custom Printed Postcards

Leave a Reply

LogoAlexa CounterFeedBurner Counter