Navigator

Monday, May 23, 2011

how to solve the disconnection when using ssh in terminal

to tell you the truth, the disconnection can be solved very easily. you need to modify  the ssh setting.  this is how-to
vim /etc/ssh/ssh_config
you maybe use sudo to get the right to modify it.
than, just insert the following two lines into the file.
TCPKeepAlive yes
ServerAliveInterval 60
in fact, the  TCPKeepAlive yes is not essential, because the value of TCPKeepAlive is yes by default.
if you want to know the meaning of two lines you insert, you can use this command in terminal
man ssh_config
you can see this:
      ServerAliveInterval
             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.  This option applies to protocol version 2 only.
      TCPKeepAlive
             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 tempo‐
             rarily, and some people find it annoying.

             The default is “yes” (to send TCP keepalive messages), and the
             client will notice if the network goes down or the remote host
             dies.  This is important in scripts, and many users want it too.

             To disable TCP keepalive messages, the value should be set to
             “no”.
i hope this will help you to understand ssh_config much better.


 this blog is posted on To be kind like water |Blog ,welcome!

No comments:

Post a Comment