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.

1 Answer 1

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.

3
  • 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, 2014 at 19:23
  • I'm getting the same error message :(
    – Tien Do
    May 10, 2016 at 13:53
  • Any solution to this? - getting the same error
    – Hackeron
    Feb 10, 2022 at 9:03

You must log in to answer this question.

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