How to maintain a persistent SSH connection?

martin f krafft
Wed, 15 Nov 2017 14:09:58 -0000

also sprach Nico Kadel-Garcia <nkadel at gmail.com> [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 | http://madduck.net/ | http://two.sentenc.es/

"i worked myself up from nothing to a state of extreme poverty."
                                                       -- groucho marx

spamtraps: madduck.bogus at madduck.net
-------------- 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
http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
URL:
<http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20171115/fc9ba588/attachment.asc>