An Application Layer Protocol that enables quick data transfer between Hosts.

It supports user authentication as well as anonymous access if configured.

It uses TCP and is thus a reliable protocol.

Security

It is a cleartext protocol and thus not encrypted. It is therefore susceptible to Packet Sniffers and therefore established as an insecure protocol and has been phased out of support in most modern browsers as of 2020.

Ports

FTP use:

  • Port 20: for data transfer
  • Port 21: for issuing commands controlling the FTP session.

Modes

FTP can run in two modes:

  • Active: The default mode that listens for the PORT command to determine which Port should be used for data transfer.
  • Passive: Enables usage of FTP servers behind firewalls or Network Address Translation (NAT)-enabled Links that makes direct TCP connections impossible. In this mode the client sends the PASV command and wait for response from the FTP server to inform what IP Address and Port to use for data transfer.

Common Commands

  • USER: Specifies the user to log in as.
  • PASS: Sends the password for the user attempting to log in.
  • PORT: When in active mode, changes the data port used.
  • PASV: Switches the connection to passive mode (from active).
  • LIST: Displays a list of files in the current directory.
  • CWD: Changes the current working directory to one specified.
  • PWD: Prints out the current working directory.
  • SIZE: Returns the size of a specified file.
  • RETR: Retrieves the specified file from the FTP server.
  • QUIT: Ends the FTP session.

Implementation