What can I do to configure SSH on both client and servers to prevent Write Failed: broken pipe errors? It often occurs if you sleep your client computer and resume later.
|
|
||||
|
I have tried this in
This is how often, in seconds, it should send a keepalive message to the server. If that doesn't work then train a monkey to press enter every two minutes while you work. You could set either Configuration for a single user can be set in file |
|||||||||||||||||||||
|
|
SSH sessions may break due to numerous and possibly unavoidable reasons. A useful utility which can be used to mitigate problems caused by this is called |
|||||||||||||
|
|
Client configuration Try creating the file:
Add the contents:
Now ssh to your server and see if your problem is fixed. ClientAliveInterval option is only useful when configuring the ssh server (aka sshd), it does not change a thing on the ssh client side, so don't use it in the above configuration file. This will send a hello-are-you-there signal to the server if no packets have been received in the preceding 30 seconds (as specified above). However, if the number of consecutive hello-are-you-there signals reach ServerAliveCountMax then ssh will disconnect from the server. This value is defaulting to 3 (so 3*30 = 90 seconds without server activity), increase it if it suits your needs. There are alot more config options to the .ssh/config file and you could read: For more information on other options. You may not want to apply this to every server you connect to which this example will. Or restrain it to only a particular server by replacing the line Server configuration Similarly you can tell the server to be gentle with your clients. The configuration file is
You can either deactivate it by setting |
|||||||||||||||||||||
|
|
I'm remotely upgrading an Ubuntu server from lucid to precise and lost the ssh connection in the middle of the upgrade with the message "Write failed. Brocken pipe". ClientAliveInterval and ServerAliveInterval did nothing. The solution is to turn on TCPKeepAlive options in client ssh:
in
|
||||
|
|
|
I absolutely love Mosh. I frequently ssh into a server, close my laptop and go to a cafe, open it up and carry on as if nothing changed.
|
|||
|
|
|
For the client, edit your
For the server, edit your
If you want ssh client to exit (timeout) automatically after 10 minutes (600 seconds).
See also: What do the options |
||||
|
|
|
For me, I was getting Others in my network stream a lot of video from Netflix and other places. I can't prove it, but I suspect its an ISP or router issue. For example, Verizon and Netflix are pointing fingers at each other for their customer's network problems. If you've got a dial-up connection and are streaming video or music with a simultaneous SSH or telnet connection, it's inevitable at some point you'll get a broken pipe message. Upgrading my ISPs broadband package seemed to make my broken connection less frequent. |
|||
|
|
|
I have a script on the remote server that never seems to fails, regardless of the SSH configuration client or server.
Save it to some dummy.sh file and quickly run it before you minimize the window or move away from it. It will keep printing the current time stamp on the server and keeps your connection alive as long as the connection is not dropped by any other reason. When you get back to that terminal, just hit CTRL+C and keep working. |
|||||
|
protected by souravc Dec 22 '16 at 11:22
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
screen? – sorin Apr 30 '12 at 7:11