This bloody error makes my headache going bigger and bigger everyday. I never met a same situation like this time.
Well, after I authenticated into SSH successfully, doing few stuffs then my SSH connection being dropped suddenly!!?
Here is my error message: packet_write_wait: Connection to XXX.XX.XX.XXX: Broken pipe
I wished my error message look like this: Write Failed: broken pipe
a lot, believe me!
I tried a tons of resolution on the Internet like added ServerAliveInterval, ServerAliveCountMax, ClientAlive….
Someone said: Turn your TCPKeepAlive to no, added ServerAlive bllah blah idiot. I did that also but still same error.
There is no luck for me until this moment.
Any help will be appreciate.
Best Answer
Dear 2018 and later readers,
Let me show you a comment from MelBurslan,
So basically, if you are trying to use
ssh username@0.0.0.0
over a VPN (corporate environment). Then this error must be there with you over and over.The only solution I found so far is mobile-shell. Thanks who created it.
You will need to install
mosh-server
in your target (the server you want to ssh'ed to) andmosh-client
in your host machine.It will auto reconnect when your packets lost, that's pretty cool and suit all our needs, I think.
Update 03/2020:
If you can't install
mosh-server
on your servers, then you could use my script here: https://github.com/ohmybash/oh-my-bash/blob/master/tools/autossh.shIt will auto-reconnect to SSH automatically whenever SSH session dead.
Happy ssh'ing!