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 [email protected] ssh [email protected]

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

6
  • 2
    Possible duplicate of SFTP over double server hop
    – Jakuje
    Nov 23, 2016 at 15:05
  • No this approach give me back: "Write failed: broken pipe"
    – Mr do
    Nov 23, 2016 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, 2016 at 10:30
  • Then post the verbose log to see what is going on there.
    – Jakuje
    Nov 24, 2016 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, 2016 at 15:38

1 Answer 1

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
1
  • 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, 2016 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .