1

Hi I'm newby to using ssh and sftp The scenario is the following one: I have to transfer a big file from local to a server passing through proxy server. local <----> proxy <-----> destination

The problem is that the file don't fit on proxy server, so i cannot perform sftp in two steps. I have to define a tunneling between local and destination, through proxy, but I don't know how. The base command is this:

ssh user@hop1.com ssh user2@destination.com

but this command doesn't work because I have to specify the ports. How can I set up a tunnel in that scenario to use sftp?

Thanks in advance Marco

  • 2
    Possible duplicate of SFTP over double server hop – Jakuje Nov 23 '16 at 15:05
  • No this approach give me back: "Write failed: broken pipe" – Mr do Nov 23 '16 at 16:31
  • No it doesn't work, each time that I run the comand line the answer is connection timed out. – Mr do Nov 24 '16 at 10:30
  • Then post the verbose log to see what is going on there. – Jakuje Nov 24 '16 at 13:05
  • @Jakuje channel 0: open failed: connect failed: Connection timed out stdio forwarding failed ssh_exchange_identification: Connection closed by remote host Couldn't read packet: Connection reset by peer. – Mr do Nov 24 '16 at 15:38
1

Ok. Don't use netcat. Use the -W switch instead:

sftp -o ProxyCommand="ssh -W %h:%p myfirsthop" mydestination

You can make this default by editing the ssh_config file, by default ~/.ssh/config:

Host mydestination
  ProxyCommand ssh -W %h:%p myfirsthop
  • the following message appear, don't log in the proxy too: >>>channel 0:open failed: connect failed: Connection timed out stdio forwarding failed ssh_exchange_identification: Connection closed by remote host Couldn't read packet: Connection reset by peer. – Mr do Nov 24 '16 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.