On 2015-06-28 02:59, Josh Grosse wrote:
>> How do you folks manage ssh sessions not dying? Do you enable these
>> options every time you install openssh on a new machine? Is there a
>> better option?
> The man page continues with, "The client alive mechanism
> is valuable when the client or server depend on knowing when a
> connection has become inactive."
>
> I don't adjust the defaults for these. I use some terrible
> WiFi connections and occaisionally have to reconnect. If I need
> to keep a shell running in the event of an unintentional
> disconnect --- or an intentional one -- I use tmux(1).
> I can reconnect and continue operating one or more shells
> without any operational impact.
Also keep in mind that keepalives are both a blessing and a curse...
On the one hand, they can save you from those horrible home routers
(mostly) that timeout your TCP sessions after a while (often a
non-configurable, but invariably too short, while at that), whether they
actually need to conserve their state-keeping space or not.
But on the other hand, if you have a stable connection through a REAL
(OpenBSD :-) ) firewall, that *doesn't* snip your TCP sessions just for
the fun of it, they may actually *cause* a disconnect.
Let's say you have an open, but idle, ssh session to your remote server
and there's a short outage in the network somewhere between the two
endpoints. If there are no keep-alive packets trying to get through and
the actual session remains idle, then you'll never notice that there was
an outage. But if there are keep-alive packets being sent that never
reaches the destination the endpoints will terminate the connection and
you will lose your terminal session no matter what.
(Moral of the story: +1 for using tmux/screen/nohup/batch/at/whatever to
keep long-running jobs safe. And when interactive, save your work often.
:-) )
Regards,
/Benny
--
internetlabbet.se / work: +46 8 551 124 80 / "Words must
Benny Lofgren / mobile: +46 70 718 11 90 / be weighed,
/ fax: +46 8 551 124 89 / not counted."
/ email: benny -at- internetlabbet.se