ftp through ssh tunnel

Luc picture Luc · Oct 13, 2011 · Viewed 18.3k times · Source

I have a machine running an ftp server and I'd like to access it from a machine located on another network behind a router only authorizing port 80.

I was thinking of a ssh tunnel like:

ssh -L local_port:${ftphost}:20 user@{sshhost}

Where ${sshhost} is another machine that have access to the ftp server ${ftphost}.

${sshhost} is reachable from my host while ${ftphost} is only reachable from ${sshhost} not mine.

Would that be the best solution ?

Answer

Robert picture Robert · Oct 13, 2011

The O'Reilly Book "SSH, The Secure Shell: The Definitive Guide" contains a whole chapter about FTP Forwarding. I think that should answer all of your questions.