Is it possible to use SSH port forwarding with FTP?

3

I tried using SSH port forwarding with FTP but it didn't work even though I used FTP connections.

It seems that the FTP server gives you another port number to use, so you must be able to connect to that port in order to receive data from the server.

So it seems rather complicated. Is there any way to do this?

It must also be noted that I have no permission to configure the FTP server, I have no access to the server besides using its FTP service.

Tianyang Li

Posted 2012-04-18T07:32:02.343

Reputation: 139

Are you aware of SFTP, and is there any reason for not using it in this case? – Daniel Andersson – 2012-04-18T07:33:47.053

I don't know about the OP, but the reason I need to is that my university's wireless blocks all outgoing ports except for 80 and 443, as well as allowing ssh access to the uni's Unix box, which doesn't have any outgoing ports blocked. – Randy the Dev – 2012-04-18T07:40:17.823

It appears that the FTP server is using passive FTP (with dynamic data ports) rather than active (data ports is 20); or that port 20 is blocked. Perhaps the OP could explain exactly what he is trying to achieve, but I assume it is similar to Andrew Dunn's situation. – lupincho – 2012-04-18T07:56:54.070

Answers

1

You need to use dynamic forwarding with -D, which creates a SOCKS proxy able to connect to any host:port, instead of a static tunnel.

Of course, a FTP client that supports connecting through SOCKS proxy is necessary. If yours does not, there are programs that reroute all connections through such a proxy – tsocks and torsocks on Linux, torcap and sockscap on Windows.

No configuration on the FTP server is needed, only that it support "passive mode" (where the server selects the temporary ports). Practically all FTP servers support this.

user1686

Posted 2012-04-18T07:32:02.343

Reputation: 283 655