tips_and_howtos:ssh_keepalive

Motivation

This is something I regularly need and I always Google it so better write it down here.

Sometimes you want your SSH session development session to be alive for longer idle periods and relogging loses the thought pointer slowing down work.

The solution

This is easy to achieve, just add this to your ~/.ssh/config:

Host myhost_to_connect_to
    HostName 1.2.3.4
    ServerAliveInterval 60

This sends activity to the ssh session every 60 seconds and should keep your sessions active.

Also remember

Many times there is a reason to shut down idle connections, mostly due to security. Se be aware of these and do not use persistant connections in an insecure environment.

  • tips_and_howtos/ssh_keepalive.txt
  • Last modified: 2021/10/24 13:51
  • (external edit)