FTP Passive Mode Explained

Category: FTP & File Management ยท Updated 2026-11-08

FTP passive mode is a connection method where the client, not the server, opens both connections needed for a file transfer, which avoids problems with firewalls and home routers. In active mode the server tries to connect back to the client, a connection that is almost always blocked today. Passive mode is the default in most FTP clients for exactly this reason.

Why FTP needs two connections

Unlike most protocols, FTP separates commands from data. One connection, the control connection on port 21, carries commands like login and "list this folder." A second, temporary data connection actually transfers the file listing or file content. How that second connection gets opened is exactly what active and passive mode disagree about.

Active mode vs. passive mode

Active modePassive mode
Who opens the data connectionThe server connects back to the clientThe client connects out to the server
Command usedPORTPASV
Behind a home router or firewallUsually fails, since inbound connections to the client are blockedUsually works, since it is an outbound connection the client initiates
Default in modern clientsNoYes

Active mode requires the client's firewall or router to accept an unsolicited inbound connection from the server, which almost no home or office network allows by default. That is why active mode largely stopped working reliably once NAT routers and firewalls became standard, and passive mode became the practical default.

How passive mode works, step by step

  1. The client connects to the server on port 21 and logs in as usual.
  2. The client sends a PASV command instead of PORT.
  3. The server opens a port from a defined passive port range and tells the client which port to use.
  4. The client connects out to that port to transfer the file or folder listing.
  5. Because the client always initiates both connections, no inbound rule is needed on the client's firewall.

Fixing passive mode connection problems

  • Enable passive mode in your client: most clients like FileZilla default to passive, but check Transfer Settings if listings hang.
  • Open the passive port range on the server's firewall: the FTP server (for example vsftpd or ProFTPD) must be configured with a limited range such as 30000 to 30999, and that range needs to be allowed through the server's firewall.
  • Set the server's reported passive IP correctly: if the server sits behind NAT itself, it must be told its public IP address so it tells clients the correct address to connect back to.
  • Allow outbound connections on the client side: a strict client firewall can still block the outbound passive connection, though this is less common than server-side misconfiguration.

A sample vsftpd passive port range configuration looks like this:

# /etc/vsftpd.conf
pasv_enable=YES
pasv_min_port=30000
pasv_max_port=30999
pasv_address=203.0.113.10

Signs you have a passive mode problem

The control connection succeeds, meaning you can log in, but listing a folder or transferring a file hangs or times out. This points specifically to the data connection, not to credentials, which rules out login errors like a 530 response and points instead at the passive port range or firewall rules on one end of the connection.

Frequently asked questions

What is the difference between active and passive FTP mode?

In active mode the server opens a connection back to the client for data transfer, while in passive mode the client opens that connection itself. Passive mode works far more reliably through firewalls and home routers because it never requires an unsolicited inbound connection.

Why does my FTP client log in but not show any files?

This is the classic symptom of a passive mode or firewall problem on the data connection. The control connection on port 21 succeeded, but the second connection used to send the folder listing is being blocked somewhere along the path.

What is a passive port range?

It is a limited set of ports, such as 30000 to 30999, that an FTP server is configured to use for passive data connections. Opening exactly that range on the server's firewall is required for passive mode to work from outside.

Should I use active or passive mode?

Use passive mode in almost every case. It is the default in modern FTP clients and works correctly behind the NAT routers and firewalls used by nearly all home and office networks.

Does passive mode work with SFTP?

No, the concept does not apply. SFTP runs entirely over a single SSH connection on port 22 and has no separate control and data connections, so it avoids this whole category of problem by design.

Can a VPN affect FTP passive mode?

Yes. A VPN can change your outgoing IP and sometimes interferes with how NAT traversal works for the passive data connection, so disabling the VPN temporarily is a reasonable troubleshooting step if passive mode suddenly stops working.

Related topics