How to maintain a persistent SSH connection?

martin f krafft madduck at
Thu Nov 16 08:44:17 AEDT 2017

also sprach Phil Pennock <phil.pennock at> [2017-11-15 19:41 +0100]:
> So, instead of running no command server side, would a suitable
> workaround be to run 'while sleep 1; do echo .; done' as the server
> command and discard stdout from ssh on the client side?  That way, the
> server side should detect the dropped link sooner, leading to sshd exit
> and port release.

First, we need to debate to death whether it should be

  while sleep 1; do echo .; done


  while echo .; do sleep 1; done


Nevermind! What an excellent idea, it's close to client-specified

I can't exactly quantify the effects yet, but a first test (I used
`cat /etc/fstab` instead of `echo .` just to fill the pipe a bit
faster) shows that the sshd(8) process (a) still sticks around
longer than it should but (b) nowhere near as long as it does when
using the ssh(1) -N option instead (i.e. run no command on the

Thank you!

@martinkrafft | |
#include <signature.h>
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