FTP

What is FTP

FTP means File Transfer Protocol which is a standard network protocol used for transferring files between a client and server.

For secure transmission, FTP with SSL/TLS(FTPS) or SSH File Transfer Protocol (SFTP) is used.

FTP Port

FTP is a TCP based service.

There are two ports : data port and command(control) port. That is, there are two channels : data channel and command channel.

For ftp server, the command port is 21, while the command port is 20 or others which depends on ftp mode.

For ftp client, the port number is random and unprivileged(>1023) port, the data port is command port + 1, e.g. command port is 1023, then data port is 1024.

FTP Mode

There are two modes : active mode and passive mode.

FTP mode is for server.

In linux, ftp server default is passive mode.

Active Mode

_config.yml

Passive Mode

If client is behind a firewall and unable to accept incoming TCP connections, passive mode may be used.

_config.yml

Data mode

  1. 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.

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

  3. EBCDIC mode. Used for plain text between hosts using the EBCDIC character set.

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

Data Transfer Mode

  1. 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.

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

  3. Compressed mode

References

wiki

ftp

ftp

Written on August 2, 2019