Report this

What is the reason for this report?

SSH disconnects itself

Posted on October 5, 2020

Greetings and good morning.

I have a DROPLET under CentOS 8 and it is working very well. So far I have been able to install Apache and PHP, but I have a bug with SSH. When I connect through SSH it does well, but after a few seconds it automatically disconnects which forces me to connect again. This happens to me with several SSH clients and I have tried it from different computers and the error is always the same: it disconnects automatically after several seconds.

I ask for the necessary support to be able to solve this problem. Thank you very much,

Edward Ocando

Edward.Ocando@gmail.com



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @edwardocando,

The standard workaround for this sort of problem is to make sure the router never thinks your connection is idle; send “fake traffic” at regular intervals. In computer jargon this is called “keep alive” traffic; we’re sending it just to keep the connection alive.

MacOS/Linux

In your $HOME/.ssh/config file you can turn on KeepAlive with the following commands:

Host *
  ServerAliveInterval 600

This tells the ssh client that if it hasn’t received a message from the server within 600 seconds then send a NOOP message to it, to get a response. This works pretty well at making the router think the connection is still busy and so don’t drop it as idle. Nicely this packet is only sent if you are idle, so it doesn’t cause any extra traffic on active sessions.

Windows, using putty

It’s the one I use when forced to use windows! It also has the ability to send keepalives, which can be found on the Connection section of the connection menu. You can enter a timeout there, and save it as part of your connection profile.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.