Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
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 at 19:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.