[TriLUG] How do I clear inactive SSH session
Jon Carnes
jonc at nc.rr.com
Sun Aug 25 17:20:56 EDT 2002
Okay... Then how about a cron job that checks on the connections and runs
something like this:
ps aux |grep ssh |cut -c1-56|grep -v ":" |cut -c9-16 |xargs kill
It's not as nice as something that checks for actual keystrokes, but it
kills any connection that is from yesterday or older... which, by the way,
might be something we should look at running on FatAlpha since it shows a
lot of old SSH connections as still being up.
We could easily modify it (using the "date" command) to knock off
connections that are two or more days old.
Jon
BTW: I know that the client side can be set to logout after a period of
inactivity. My old workstation was setup to drop any ssh connection
without activity if nothing happened for 15 minutes. Cygwin came with this
timeout as the default.
===
On Monday 26 August 2002 10:00 am, Jeremy Portzer wrote:
> Hi,
>
> It strikes me that these options won't do quite what Kevin was looking
> for. A connected client will always respond to the client keep alive
> mentioned above, right? So if the network connection is working fine,
> but the *user* is just idle, nothing will ever be disconnected. The
> above options appear to be useful for when the network goes down, or if
> the client just "goes away" without closing down the ssh connection.
>
> --Jeremy
>
More information about the TriLUG
mailing list