Home » Hosting Encyclopedia » Hosting Terms » FTP » FTP Port

FTP Port

FTP by definition uses the TCP transport protocol exclusively and doesn’t use the UDP for its transport purposes. Usually, an application layer protocol will use one or the other. One important exception of that rule is DNS or Domain Name System. FTP also is kind of different due to the fact that it uses two ports to complete its task. It usually utilizes port 20 for transferring data and port 21 for listening to commands. It’s also true that transferring data over FTP port 20 is not mandatory and it can be done through another port as well. This is where it gets confusing for many users. FTP has two modes of operation – active and passive. Both are started by the FTP client and then acted upon by the FTP server.

Active FTP

Inactive mode the FTP client connects from a random unprivileged port (N, which is usually 20) to the FTP server’s command FTP port, which is port 21. Then, the client starts listening to port N+1 and sends a command to the FTP server. After that, the server connects back to the client’s specified data port from its local one. From the server-side firewall’s point of view, to support FTP in active mode these ports have to be opened: FTP server’s port 21 from anywhere (Client initiates connection); FTP server’s port 21 to ports > 1023 (Server responds to client’s control port); FTP server’s port 20 to ports > 1023 (Server initiates data connection to client’s data port); FTP server’s port 20 from ports > 1023 (Client sends ACKs to server’s data port).

Passive FTP

In this mode, the FTP client initiates two connections to the FTP server. We need to keep in mind as well that both of these connections are using ephemeral ports themselves, and that’s ok. By opening two connections, or sockets with the FTP server, the client is able to resolve the issue of its firewall denying access to the FTP server initiating contact on one of the client’s high ephemeral ports. One of the connections opened by the client will contact the server on FTP port 21, and issue it the PASV (passive) command, vice the normal PORT command when using active FTP. Now what happens is that the FTP server opens an ephemeral port and issues the PORT command to the FTP client. With this in hand, the client then starts a connection back to the server FTP port for the data transfer.

Was this article useful?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Newest Articles:

How to Enter the WordPress Admin Panel

If you are reading this tutorial, you are probably on your way to creating your first website. In the previous tutorial, we showed you step-by-step how to install WordPress on your domain using Zacky Installer. Now you probably want to enter the WordPress admin panel...

How to Install WordPress using the Zacky Installer

WordPress is a simple and flexible content management system that allows you to create and manage the content of your website. The first thing to mention is that you don't need any programming skills or technical knowledge to use WordPress. All you have to do is read...

Second Level Domain (SLD)

The Second Level Domain or SLD is an essential part of the hierarchical Domain Name System. It is the second part of the full domain name after the Top Level Domain, on its left side. The Second Level Domain is often the same as the website name, the company or the...

Top-Level Domain (TLD)

The Top Level Domain name (TLD) is the last or right-most fragment of the domain name. The parts of the domain name are separated with dots and form their own hierarchy in the Domain Name System (DNS). There is a Top-Leveл Domain list where you can see all available...

IANA

What is IANA? Although the Internet is not really a centralized system, there are some key infrastructure elements that need to be coordinated. The Internet Assigned Numbers Authority (IANA) is an organization that was founded in 1988 by the government of the U.S.A....

Ready to Create Your Website?