net2ftp
English

Active and passive FTP: what’s the difference?

You can log in, but the file list never appears or a transfer hangs? The cause is almost always the FTP data connection, and the fix is often one checkbox: passive mode.

FTP uses two connections

FTP was designed in the 1970s, long before firewalls. It uses one connection for commands (the control connection, usually port 21) and opens a new data connection for every file list and every file. Active and passive mode only differ in who opens that data connection.

Passive mode: the client connects

The client asks the server for a port (the PASV or EPSV command). The server opens a random port and the client connects to it. This works well when the client is behind a firewall or a home router, which is why passive mode is the default in browsers, in most FTP programs and in net2ftp. The server’s firewall must allow its range of passive ports.

Active mode: the server connects back

The client tells the server an address and a port (the PORT or EPRT command), and the server connects back to it. This works when the server is behind a firewall that only lets port 21 in, but the client must accept incoming connections. net2ftp supports both modes.

Problems and solutions

What you seeWhat to do
The login works, but the folder never loads or a time-out followsSwitch the mode: untick Passive mode under Advanced options on the login page, or tick it if it was off.
“… did not answer the request for passive mode”The server (or a firewall in front of it) blocks passive mode. Log in again with passive mode turned off.
Active mode works with FTP, but not with FTP over TLSFirewalls can’t read encrypted commands, so they can’t open the port for active mode. Use passive mode, or SFTP.
Neither mode worksThe server’s firewall blocks the data ports. Ask your hosting provider, or use SFTP, which needs only one port.

For server administrators

For passive mode, choose a small port range, open it in the firewall and set it in the FTP server: pasv_min_port and pasv_max_port in vsftpd, PassivePorts in ProFTPD, or -p in Pure-FTPd. Behind NAT, the server must also announce its public address. net2ftp ignores the address in the passive reply and connects to the server’s own address, so a wrong address there doesn’t stop it.

Related guides