askvity

What Port is FTP?

Published in Networking Ports 2 mins read

FTP, or File Transfer Protocol, uses two ports for communication: a command port and a data port. The command port is used to send commands, such as logging in or requesting a file transfer. The data port is used to transfer the actual file data.

FTP Port Numbers Explained

Port Type Port Number Function
Command Port 21 Sends commands from the client to the server, such as login and file requests.
Data Port 20 Transfers the actual data, like file contents, between the client and server.



As specified in the reference, FTP traditionally uses port 21 for the command port and port 20 for the data port. It's important to note that while these are the traditional ports, passive FTP can sometimes use different data ports that are negotiated dynamically.

Key Insights

  • FTP utilizes two distinct ports: the control port for commands and the data port for file transfer.
  • Standard setup is port 21 for the command channel and port 20 for the data channel.
  • Passive mode FTP may use different dynamic ports for data transfer.

Practical Example

When you use an FTP client to connect to an FTP server, the following happens:

  1. The FTP client connects to the server on port 21.
  2. The client sends the username and password on port 21.
  3. Upon authorization, a data connection is established.
  4. The data (file) is transferred between client and server using port 20 (or a dynamic port in passive mode)
  5. The command connection (port 21) is used to send further commands while the data connection (port 20 or dynamic) performs file transfer.

In summary, while there are two ports associated with FTP, the primary ports are 21 for commands and 20 for data.

Related Articles