/
/
Error connecting to an FTP server

Error connecting to an FTP server

Symptoms

When trying to connect to an FTP server, the following errors occur:

In Linux

229 Entering Extended Passive Mode (|||35514|)
ftp: Can't connect to `91.221.0.251:35514': No route to host

In FileZilla

Error:	Connection timed out after 20 seconds of inactivity
Error:	Failed to retrieve directory listing

Causes

  • Restrictions on port 20 and passive FTP ports on the server
  • The target server is located behind NAT, there are port restrictions on network equipment

Solution

Enable an address range for passive mode in the FTP server settings by uncommenting the corresponding lines in the configuration files:

etc/proftpd.conf or etc/proftpd/proftpd.conf for ProFTP:

#PassivePorts    35000 35999

/etc/pure-ftpd/pure-ftpd.conf for Pure-FTP:

# PassivePortRange    		 30000 50000

 

After introducing adjustments, it's necessary to restart the FTP server service:

  • for ProFTP - systemctl restart proftpd;
  • for Pure-FTP - systemctl restart pure-ftpd.

 

Make sure that your server's firewall settings and those of your hosting provider do not prohibit connections to ports 20 and 35000-35999 (or 30000-50000 when using Pure-FTP).

If the server is behind NAT, make sure that its settings on the hosting provider side allow forwarding these ports to your server.

 

As a possible supplementary solution, specify the use of only one of the modes in the FTP client settings: active or passive.

In this article