Navigation

How to fix ssh timeout problems

If you use ssh a lot, you may have noticed that your ssh session times out and you’re logged out every once in a while.

For example while you were using SecureCRT, you got:

The semaphore timeout period has expired

The solution is to send a protocol NO-OP every few seconds to keep the connection alive.
Usually SSH clients have this feature disabled and you can enable it.
SecureCRT has this feature on:
Right click on host -> Properties
or
Right click on the host tab -> Session Options
navigate to Terminal -> Anti-idle -> check/enable "Send protocol NO-OP", usually i use 20 seconds.

I just recently transfered a cPanel account from one server to another using WHM "Copy an account from another server" feature, and i got this error message:

... Timeout during ssh session ...
Transfer Error
Unable to package account

This usually happens while you are transfering a very big account and the SSH session time out while it's verifying the MD5 hash or compressing the directories.

The solution is simply to edit /etc/ssh/ssh_config and add

ServerAliveInterval 20

on the client side,the machine you want to transfer the account into.

Or you can edit /etc/ssh/sshd_config and add:

ClientAliveInterval 20

on the server side, the machine you want to transfer the account from.
Don’t forget to restart sshd on the server after you save the file.

Reply
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <cite> <sup> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

More information about formatting options