TCP Port Number 21 and How It Works With FTP

Port 21 controls the FTP session

The File Transfer Protocol provides a framework to transfer information between two networked computers, much like Hypertext Transfer Protocol does through a web browser. FTP, however, operates on two different Transmission Control Protocol ports: 20 and 21. FTP ports 20 and 21 must both be open on the network for successful file transfers.

After the correct FTP username and password are entered through FTP client software, the FTP server software opens port 21, which is sometimes called the command or control port, by default. Then the client makes another connection to the server over port 20 so that the actual file transfers can take place.

The default port for sending commands and files over FTP can be changed. The standard exists, however, so that client/software programs, routers, and firewalls can agree on the same ports, thus easing configuration.

An illustration of file transfer protocol (FTP).
 Getty Images

How to Connect Over FTP Port 21

If FTP fails, the correct ports may not be open on the network. This blockage may occur on either the server side or the client side. Any software that blocks the ports must be manually changed to open them, including routers and firewalls that might block the ports if the operating system doesn't.

By default, routers and firewalls might not accept connections on port 21. If FTP isn't working, it's best to first check that the router is forwarding requests properly on that port and that the firewall isn't blocking port 21.

Use Port Checker to scan your network to see if the router has port 21 open. A feature called passive mode helps verify if barriers to port access are present behind a router.

In addition to ensuring port 21 is open on both sides of the communication channel, port 20 also should be allowed on the network and through the client software. Neglecting to open both ports prevents the full back-and-forth transfer from being made.

When it is connected to the FTP server, the client software prompts with the login credentials—username and password—that are necessary to access that particular server. Many FTP servers, if you log in through telnet or a Secure Shell connection, will offer default anonymous credentials.

FileZilla and WinSCP are two popular FTP clients. Both are available free of charge.