How to maintain a persistent SSH connection?

Nico Kadel-Garcia
Wed, 15 Nov 2017 13:42:19 -0000

On Wed, Nov 15, 2017 at 8:08 AM, martin f krafft <madduck at madduck.net>
wrote:
> Hello,
>
> I'm tasked with establishing a persistent SSH connection across
> a very unreliable link, for a remote port forward (always port
> 2217). I figured I'd use ServerAliveInterval to make sure that the
> ssh(1) process dies when the connection appears down, and I use
> systemd to restart it in this case. This works fine.

I use "autossh" for precisely this reason, partly because I've
found
it very effective at re-establishing the link, partly for the logging,
and partly for the daemonization of what can be used to keep an SSH
tunnel alive consistently.