How to keep the SSH connection active

shape
shape
shape
shape
shape
shape
shape
shape

When making an SSH connection on Linux, after a few minutes of inactivity, the connection is lost. In this tutorial, we’ll teach you how to keep an SSH connection alive on Linux.

We will edit the “/etc/ssh/ssh_config” file :

nano /etc/ssh/ssh_config

Then simply “uncomment” or add the following lines:

Host *
ServerAliveInterval 30
ServerAliveCountMax 2

Restart the SSH Client:

service ssh restart

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest news

Latest news directly from our blog.