Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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!

share|improve this answer
    
I don't have that file, only /etc/ssh/ssh_config but that doesn't have those variables in. –  DisgruntledGoat Feb 15 '13 at 0:20
up vote 0 down vote accepted

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.

share|improve this answer

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.