Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Red Hat Linux Enterprise Edition 5 on my box. Recently I started having issues with my SSH service not keeping my connection and randomly disconnecting my clients.

Ping works perfectly fine, except that port 22 is blocked randomly.

Has anyone faced this issue? What is the solution?

share|improve this question
up vote 4 down vote accepted

The problem is likely an intervening firewall with a timeout.

You can try telling ssh to keep the connection active by appending to ~/.ssh/config:

Host *
    ServerAliveInterval 90

It could also be intermittent failures of the network. From the sshd_config man page regarding TCPKeepAlive (on by default):

this means that connections will die if the route is down temporarily, and some people find it annoying.

share|improve this answer

Your Answer


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.