[ssh] ssh keep-alive tip

TA/Common 2012. 3. 27. 10:46

 

1. ssh -o TCPKeepAlive=yes mark@localhost

 

or

 

2.

Remember that

ServerAliveInterval

is limited by

ServerAliveCountMax

and that ServerAliveCountMax is set to 3 by default!

That is, if you set ServerAliveInterval to 60 and ServerAliveCountMax is left to default value (3), after the client has sent 3 keep alive packets it will disconnect. That makes 60 x 3 = 180 seconds.

So if you want more time away, you set ServerAliveInterval to 60 and ServerAliveCountMax to the numer you want (for example: 100). The client will send one keep alive packet every 0 seconds for 100 times or, if you prefer, 100 keep alive packets, one every 60 seconds. :D

You set this up in your $HOME/.ssh/config file.

Most of these options are explained in man ssh_config.

Thanks a lot to Cam for pointing us all in the right direction!!!!

Posted by 옥탑방람보
,