Re: ssh session times out annoyingly fast, why?
On Wed, Sep 23, 2020 at 10:30:15AM +0300, Anssi Saari wrote:
> Britton Kerin <britton.kerin@gmail.com> writes:
> > I'm using ssh from a debian box to a rasberry pi (sorta debian also :).
> >
> > For some reason ssh sessions seem to time out pretty quickly.
How quickly, exactly? What is the actual message/behavior you see when
it happens? Are they both on the same LAN, or is there some complexity
in between them (especially a NAT router)?
> Well, the keepalives themselves can cause a disconnect if the keepalive
> messages are not reaching the other end due to bad connection for
> example. Looks like by default in Debian client sends keepalives if
> server is quiet but server doesn't send keepalives to a client.
The normal reason people need to use ServerAlive or ClientAlive is NAT.
If your connection from ssh client to ssh server goes through a NAT
router, the router may keep track of activity on that connection, and
drop the translation when it goes idle for 5 minutes or so. Forcing the
*Alive packets to happen every few minutes prevents a NAT timeout.
If there is no NAT involved, then I agree with the previous suggestion
that this might be a shell's TMOUT variable. Are you sitting at a shell
prompt when the "timeout" occurs? Does the timeout stop occurring when
you're inside a text editor, for example?
Much more information is needed here.
Reply to: