What is FTP

« Previous Article Back to Articles Next Article »

File Transfer Protocol (FTP) is a standard network protocol used to transfer files from one host to another host over a TCP-based network, such as the Internet.

FTP is built on client-server architecture and uses separate control and data connections between the client and the server. FTP users may authenticate themselves using a clear-text sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it. For secure transmission that hides (encrypts) the username and password, and encrypts the content, FTP is often secured with SSL/TLS ("FTPS"). SSH File Transfer Protocol ("SFTP") is sometimes used instead.

FTP may run in active or passive mode, which determines how the data connection is established.[5] In active mode, the client creates a TCP control connection to the server and sends the server the client’s IP address and an arbitrary client port number, and then waits until the server initiates the data connection over TCP to that client IP address and client port number.[6] In situations where the client is behind a firewall and unable to accept incoming TCP connections, passive mode may be used. In this mode, the client uses the control connection to send a PASV command to the server and then receives a server IP address and server port number from the server,[6][5] which the client then uses to open a data connection from an arbitrary client port to the server IP address and server port number received.[4] Both modes were updated in September 1998 to support IPv6. Further changes were introduced to the passive mode at that time, updating it to extended passive mode.[7]

While transferring data over the network, four data representations can be used:

ASCII mode: used for text. Data is converted, if needed, from the sending host’s character representation to "8-bit ASCII" before transmission, and (again, if necessary) to the receiving host’s character representation. As a consequence, this mode is inappropriate for files that contain data other than plain text.

Image mode (commonly called Binary mode): the sending machine sends each file byte for byte, and the recipient stores the bytestream as it receives it. (Image mode support has been recommended for all implementations of FTP).

EBCDIC mode: used for plain text between hosts using the EBCDIC character set. This mode is otherwise like ASCII mode.

Local mode: Allows two computers with identical setups to send data in a proprietary format without the need to convert it to ASCII.

For text files, different format control and record structure options are provided. These features were designed to facilitate files containing Telnet or ASA.

Stream mode: Data is sent as a continuous stream, relieving FTP from doing any processing. Rather, all processing is left up to TCP. No End-of-file indicator is needed, unless the data is divided into records.

Block mode: FTP breaks the data into several blocks (block header, byte count, and data field) and then passes it on to TCP.[8]

Compressed mode: Data is compressed using a single algorithm (usually run-length encoding).