Tuxtips - Linux HowTos

Linux HowTos live here

How to keep ssh connection alive

08 Jul 2020

It can be frustrating when you connect to a server through ssh and your connection is lost after some period of inactivity - you have to connect to the server again.

To avoid this, you need to make a small change in /etc/ssh/ssh_config or ~/.ssh/config. Just add the following:

click code to copy
ServerAliveInterval 60
Save the file and your ssh sessions should last uninterrupted.
Tested on: Arch Linux, June 2020.
Comments Add your comment

Enter the digit "three" (spam protection):