Mailinglist Archive: opensuse (1014 mails)

< Previous Next >
Re: [opensuse] ssh keep alive?
On 2017-02-19 23:37, Werner Flamme wrote:
Am 19.02.2017 um 22:19 schrieb Carlos E. R.:

I don't have this problem on the LAN, but when connecting via Internet
to my home server, I find after some time of no use that the terminal
does not respond any more. I have to "kill ssh" to recover that terminal.

I suppose I have to use a keep alive option. The manual has some:

-o option



Which one?


in the output of "man ssh_config" you find the meaning of those parameters.

Ah, didn't think of that manual. Thanks :-)

Sets a timeout interval in seconds after which if no data
has been received from the server, ssh(1) will send a message through
the encrypted channel to request a response from the server.
The default is 0, indicating that these messages will not
be sent to the server.

Sets the number of server alive messages (see below) which
may be sent without ssh(1) receiving any messages back from the server.
If this threshold is reached while server alive messages are being
sent, ssh will disconnect from the server, terminating the session. It
is important to note that the use of server alive messages is very
different from TCPKeepAlive (below). The server alive messages are sent
through the encrypted channel and therefore will not be spoofable. The
TCP keepalive option enabled by TCPKeepAlive is spoofable. The server
alive mechanism is valuable when the client or server depend on knowing
when a connection has become inactive.

The default value is 3. If, for example,
ServerAliveInterval (see below) is set to 15 and ServerAliveCountMax is
left at the default, if the server becomes unresponsive, ssh will
disconnect after approximately 45 seconds.

Specifies whether the system should send TCP keepalive
messages to the other side. If they are sent, death of the connection
or crash of one of the machines will be properly noticed. However, this
means that connections will die if the route is down temporarily, and
some people find it annoying.

Well, I tried "ssh -o ServerAliveInterval=60 ..." and it appears to do
the trick. I will add that setting in the .ssh/config file:

host myhost.domain
Port someport
ServerAliveInterval 60

and see what happens...


Yes, it worked.

Cheers / Saludos,

Carlos E. R.

(from 42.2 x86_64 "Malachite" (Minas Tirith))

< Previous Next >
Follow Ups