Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a problem with an SSH session freezing after using it again when it was idle for a while.

The problem is that the session doesn't freeze immediately, I can still use it. But as soon as a command sends more data, it freezes before any output arrives, and I have to restart the terminal.

If have read earlier solutions about MTU, but there, the session freezes everytime. Here it only happens after a period of inactivity.

Note that I have set ServerAliveInterval 120 in .ssh/ssh_config

Any clues about how I can solve this?

share|improve this question
    
Is there a firewall between the client and server? –  MattBianco Jun 26 '12 at 12:24
    
There probably is, though I have no control over it (corporate firewall). –  Ikke Jun 26 '12 at 12:32
    
I think the first bullet in my answer will be helpful. Especially in conjunction with the first few lines of man ssh_config. –  MattBianco Jun 26 '12 at 13:02
2  
Change ~/.ssh/ssh_config to ~/.ssh/config. Make sure the permissions on it are 600. –  uther Jun 26 '12 at 15:34
    
Note that my answer (the first) contains the solution as well as some other hints towards troubleshooting ssh :-) –  MattBianco Aug 3 '12 at 7:30
add comment

3 Answers 3

up vote 3 down vote accepted

Change ~/.ssh/ssh_config to ~/.ssh/config. Make sure the permissions on it are 700.

This discussion has a lot of good information. You can also follow the tag for ssh (just click on /ssh under your question) to go to a tag wiki for more information and trouble shooting guidance.

share|improve this answer
1  
I had named it wrong. After renaming it, I (so far) didn't have any freezes anymore. –  Ikke Jul 4 '12 at 14:29
add comment

Suggestions:

  • Try setting the ServerAliveInterval, ServerAliveCountMax, and TCPKeepAlive options on the command line instead of through ssh_config, to rule out that there is a problem reading your settings. Perhaps the ssh_config should be called just config instead?
  • Use the verbose flag (more than once) to increase chances of an explanatory error message
  • Make sure the ServerAliveInterval * ServerAliveCountMax is less than the firewall's idle time threshold before tearing down your ssh session (ask your network admin).
  • If the server is yours, you could try the ClientAlive*-options there.
  • Check for version incompatibilities if not OpenSSH on both client+server.
share|improve this answer
add comment

you can set up your client to send the tcp keep alive messages. I know it is under the connection options in putty. Not sure on the command line options but this solved it for me when I was having problems. Though it only did it to me on the win7 machines at school.

share|improve this answer
add comment

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.