How to maintain a persistent SSH connection?

martin f krafft madduck at
Thu Nov 16 01:09:58 AEDT 2017

also sprach Nico Kadel-Garcia <nkadel at> [2017-11-15 14:42 +0100]:
> > 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.

Yes, autossh is effectively the same as ServerAliveInterval + systemd.
I've used it for many many years, but with SAI and systemd, it's
become obsolete I think.

However, I can't see how autossh would solve the lingering sshd(8)
process problem on the server.

@martinkrafft | |
"i worked myself up from nothing to a state of extreme poverty."
                                                       -- groucho marx
spamtraps: madduck.bogus at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: digital_signature_gpg.asc
Type: application/pgp-signature
Size: 1118 bytes
Desc: Digital GPG signature (see
URL: <>

More information about the openssh-unix-dev mailing list