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

Dan Mahoney (Gushi) danm at prime.gushi.org
Thu Oct 19 01:09:40 EDT 2017


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
---------------------------



More information about the mosh-devel mailing list