wget ftp connection failing after PASV command

Solution 1:

For file transfers or directory listings FTP opens additional TCP connections on dynamic ports. In active mode the client creates a local listener and let the server know about its IP:Port using the PORT command and the server then connects to the clients port (usually from port 20 on the server side). In passive mode the server opens the port and let the client know where it listens in response to the clients PASV command.

Both modes need

  • an IP reachable by the other side, e.g. active mode with a client behind a simple NAT router will not work
  • none or a wide open firewall, because the ports on the listener side will be different for each connection.

If you don't have any problem to reach it from your desktop client it might be, that your desktop client is using active mode, while wget uses passive mode, or that there is no firewall/NAT router between your desktop and the server, but between your shared hosting and the server there is one.

Without getting more details about your setup its hard to speculate more.

Solution 2:

Another way is to avoid the passive mode, add --no-passive argument in your wget command can do it.

wget -r --no-passive --no-parent ftp://account:<password>@<ip address>/folder/ -P /root