[mosh-devel] [mosh-users] How to properly kill old mosh-server connections

Keith Winstein keithw at cs.stanford.edu
Thu Oct 19 05:10:01 EDT 2017


Hello Dan,

For idea #1, please check out the MOSH_SERVER_NETWORK_TMOUT
and MOSH_SERVER_SIGNAL_TMOUT environment variables. These are documented in
the mosh-server(1) man page. The feature was released in Mosh 1.2.6 (August
2016) so your mosh-server needs to be at least that new.

For idea #2, we could certainly try to be more sophisticated than the
current behavior, but I think many people deal with this by using mosh to
invoke a command like "screen -dr", which automatically cleans up any older
mosh session before starting the new one.

E.g.: mosh user at server -- screen -dr

Regards,
Keith

On Wed, Oct 18, 2017 at 10:09 PM, Dan Mahoney (Gushi) <danm at prime.gushi.org>
wrote:

> All,
>
> I'm aware that for every mosh connection (i.e. one each from my laptop,
> desktop, and other laptop), I'm going to have a mosh-server connection.
> These each have their own ssl key, and they pass a screen session around,
> by doing a screen -d -r on whatever system I sit down at.
>
> Recently, it seems like I had something like 20 mosh-server sessions
> running, which cropped up at various times as I did updates on my various
> systems, and then ssh'd back in.
>
> I'm aware that mosh cannot possibly know when a system has been rebooted,
> so can't know when to kill a server session.
>
> That said, one useful idea would be killing any session that hasn't been
> "used" in over some period of time (say, a week?).  This could be done by
> giving mosh-server some kind of idle timeout -- or by making this
> queryable somehow, so that a server-side crontab could clear these out.
>
> A second (more complicated) idea would be -- assume that I'll only ever
> connect once from a given machine -- and allow me to "kick" any other
> connections from my existing hostname.  Is this possible?  It would
> require mosh to know the hostname of the client machine and somehow be
> able to compare that on servers.  (Obviously this is less workable when
> your hostname is dynamic, assigned via your DHCP server or based on your
> RDNS).
>
> -Dan
>
> --
>
> --------Dan Mahoney--------
> Techie,  Sysadmin,  WebGeek
> Gushi on efnet/undernet IRC
> ICQ: 13735144   AIM: LarpGM (Farewell, AIM!)
> Site:  http://www.gushi.org
> ---------------------------
>
> _______________________________________________
> mosh-users mailing list
> mosh-users at mit.edu
> http://mailman.mit.edu/mailman/listinfo/mosh-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/mosh-devel/attachments/20171019/9ecdcbaa/attachment.html


More information about the mosh-devel mailing list