SSH keep alive

Kenneth Burgener kenneth at
Mon Feb 23 13:46:04 MST 2009

On 2/23/2009 8:48 AM, Nicholas Leippe wrote:
>> The other feature I found, in Putty, is the "session keep alive"
>> feature, which you can also specify time between keep alives.  As far as
>> openSSH, I found a "TCPKeepAlive" option, but I am not sure this does
>> the same thing as the session keep alive, and I don't see an option to
>> specify the time between keep alives.
> Yes, this is the keep alive. You may or may not want this feature, however. If 
> it is enabled, yes, it will send out keep alive packets so that any router nat 
> forwarding tables are refreshed. However, it has the side effect that if it 
> fails to receive a keep alive packet it will assume that the connection is 
> gone for good and close it on you.
> I usually turn it off entirely so that my ssh connections do not notice any 
> temporary network outages.
> The interval is specified by the server in sshd_config as ClientAliveInterval 
> and/or by the client in ssh_config as ServerAliveInterval.
> See man sshd_config(5) and ssh_config(5).

Without the keep alive, doesn't the SSH connection automatically 
terminate after so many minutes?  Is the auto terminate a function of a 
NAT router in the path, or is that a client or server option?  I just 
want my connection to stay open indefinitely, so if keep alives are not 
the way to go about, is there a better way?


More information about the PLUG mailing list