Keeping SSH connections alive
Depending on how your SSH server or internal firewalls are configured, your SSH session may automatically disconnect after some time. It's possible to configure SSH to send a special packet every certain number of seconds, to keep the connection from idling and becoming a candidate for disconnection. This is useful if you have a service that utilizes SSH, that you do not want to be disconnected. To employ this tweak, we must configure the ServerAliveInterval setting.
There are two ways of configuring this, one that affects your user account and another that will deploy the setting system wide. First, let's explore how to configure this for your user account.
Remember the ~/.ssh/config file that we configured earlier ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access