3

Let's say I connect from a client to a server via SSH, and in the middle of the session I pull the server's network cable. On the client, the ssh connection stays alive for around 15 minutes before failing with a "Broken pipe" message. How can I adjust this timeout? In my case, I need to decrease it so that SSH fails early when there is a network issue.

I found a lot of information on how to avoid disconnections on idle sessions, or have longer connection setup timeouts, but not on the timeout of the established SSH connection itself. I also know there are such timeouts at the TCP level, but I suspect SSH sets up the socket with different values, as TCP timouts are normally around one minute, not the 15 minutes I am observing with SSH.

Client and server are both Ubuntu 14.04 server edition.

6

You can set the ServerAliveInterval and ServerAliveCountMax settings on the client. The maximum time before the client will disconnect is approximately the product of those two.

  • 1
    Thanks a lot, that did it. The message that comes out after the timeout is "Timeout, server xxxx not responding.", rather than "Broken pipe". – gpothier Jun 12 '14 at 19:23
  • I'm getting the same error message :( – Tien Do May 10 '16 at 13:53

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.