What is the purpose of netcat's "-w timeout" option when ssh tunneling?

Posted by jrdioko on Server Fault See other posts from Server Fault or by jrdioko
Published on 2012-09-03T18:35:35Z Indexed on 2012/09/04 3:39 UTC
Read the original article Hit count: 528

Filed under:
|
|
|
|

I am in the exact same situation as the person who posted another question, I am trying to tunnel ssh connections through a gateway server instead of having to ssh into the gateway and manually ssh again to the destination server from there. I am trying to set up the solution given in the accepted answer there, a ~/.ssh/config that includes:

host foo
  User webby
  ProxyCommand ssh a nc -w 3 %h %p

host a
  User johndoe

However, when I try to ssh foo, my connection stays alive for 3 seconds and then dies with a Write failed: Broken pipe error. Removing the -w 3 option solves the problem. What is the purpose of that -w 3 in the original solution, and why is it causing a Broken pipe error when I use it? What is the harm in omitting it?

© Server Fault or respective owner

Related posts about ssh

Related posts about proxy