Ftp over ssh tunnel
This isn’t radical, but it tripped me up for half an hour…
SSH tunneling is a great easy way of remotely accessing a network if you’ve access to an SSH account within it - using something like PuTTY you set up whichever ports you want access to and they magically appear locally.
But ftp is a bit trickier - the protocol needs two ports - 21 and another one. I couldn’t figure out how to configure tunnels in PuTTY to let the second port through, even using PASV connections.
But then I twigged all the references to SCP and SFTP which didn’t seem relevant as I wanted to reach a different remote machine to the one I was SSH’d to - tunnel port 22 to the machine you want to reach using PuTTY and then with the tunnel open you can use something like PSFTP to SFTP to the remote machine.
Make sense?









I’m not sure if I’m reading you right, but I think you’re saying, to copy files from machine A to machine B, where both have sshd servers:
Instantiate SSH connection from A —> B with some form of tty; then SFTP from A —> B?
Or is there a third machine? You ssh from A –> B, then from B —> C, and copy files from A to C, through the tunnel?
I don’t get it. Why not just sftp://user:password@B, from A? (or whichever way around). That always works for me (although I generally use Nautilus, I’m pretty sure I’ve done it with Filezilla in windows too)
As an aside, I’m fairly sure that ’scp user@A:/path/ user@B:/path/’, where A and B are both remote machines works, but don’t quote me on that. It can work in theory, but I suspect security settings might get in the way. They sometimes do, depending on the level of paranoia your ssh server is set to. Mine tend to be set to ‘very’
Comment by mat — February 9, 2008 @ 2:00 pm
Mat,
A and B are machines at home, both running sshd. Ssh on A is available externally, B isn’t.
I was at work and wanted to use ftp or similar to transfer files to B, but could only access A.
I had been successfully using an ssh tunnel to A to get all around my network, but couldn’t tunnel ftp to other machines. But, you can scp or sftp.
That’s probably even less clear?
Comment by jaydublu — February 10, 2008 @ 10:55 am
Ah, right. Gotcha. Makes sense now. One of those “dead simple really but how to explain it” situations…
Comment by mat — February 11, 2008 @ 1:31 pm