/
/
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
  • Target server is behind NAT and port restrictions are set on network equipment

Solution

Enable the port range for passive FTP mode to work.

ProFTP

To enable the address range for passive FTP mode in ProFTP, uncomment the line with the PassivePorts directive in the file at the following path:

  • /etc/proftpd/proftpd.conf - for RHEL-based systems;
  • /etc/proftpd.conf - for Debian-based systems.

PureFTP

To enable the address range for passive FTP mode in PureFTP, on RHEL-based systems, uncomment the line with the PassivePorts directive in the file at /etc/pure-ftpd/pure-ftpd.conf and set it to “30000 35999”.

To enable the address range for passive FTP mode in PureFTP, on Debian-based systems, create a file at /etc/pure-ftpd/conf/PassivePortRange and enter the value “30000 35999”. This can be done quickly with the following command:

echo "35000 35999" > /etc/pure-ftpd/conf/PassivePortRange

Network settings

Make sure that your server's firewall settings and your hosting provider's firewall settings do not restrict connections to ports 20 and 35000 through 35999.

If the server is behind NAT, make sure that the hosting provider has a forwarding of these ports to your server.