2

I use ssh to log onto my server. Sometimes, I leave it connected and go away from the computer, in which time the computer goes to power saving mode (or whatever it's called - the screen just goes black).

When I come back and try doing anything in that terminal window, nothing appears to happen. Though after at least 10 minutes it eventually says "write failed: broken pipe".

My question is, what's the deal with the massive delay? Why does it take so long to decide that it can no longer connect to the server? Is there any way to reduce that time, besides just closing the terminal and starting afresh?

2 Answers 2

0

you could debug ssh by types in ssh -vvv ... This will not only debug the login but also debugs the sessions. It can get somewhat annoying when it continually throws in the debug however. The amount of 'v's determines the amount of debug which is active in the sessions (the more v's the more levels of debuging). I'm not positive this will help identify the problem but it could help track it down. Usually there is a stay alive time set in your client ssh that will send "pings" to tell the server that you are still connected here is where that variable is set:

/etc/ssh/sshd_config 
ClientAliveInterval 30
ClientAliveCountMax 5 

Where ClientAliveInterval: Sets a timeout interval in seconds (30) after which if no data has been received from the client, sshd will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol version 2 only. ClientAliveCountMax: Sets the number of client alive messages (5) which may be sent without sshd receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session.

If you alter those settings make sure to restart sshd via this command:

/etc/init.d/ssh restart

Hope this helps!

1
  • I don't have that file, only /etc/ssh/ssh_config but that doesn't have those variables in. Feb 15, 2013 at 0:20
0

Never found a true answer to this question, although interestingly on Mac the timeout delay is much, much shorter (maybe 30 seconds).

However, I found that you can type ~. (tilde then period) to close the session immediately. So if the SSH becomes unresponsive I just do this.

You must log in to answer this question.

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