Network - Server

How to prevent Linux SSH client from disconnecting using ServerAliveInterval

You can install autossh through brew:

brew install autossh 

or use ServerInterval

 

First method to use ssh keepalives (ServerAliveInterval) is to use the global configuration file /etc/ssh/ssh_config or /usr/local/etc/ssh/ssh_config by uncommenting/adding the option:

Code:
...
ServerAliveInterval 30
...


30 being the number of seconds at which probes have to be sent.

Prevent SSH Disconnect by using ServerAliveInterval in ~/.ssh/config file


The second method to use ssh keepalive is in the user's ssh client configuration file ~/.ssh/config. This method is good when you don't have permissions to change the global ssh configuration file:

Code:
Host *
  ServerAliveInterval 30


This sets the keepalive interval to 30 seconds for all hosts. Of course, it can be used also on per-host basis.

Prevent SSH Disconnect by using ServerAliveInterval option in SSH cli command


The third method to use ssh keepalive is by supplying the option to ssh command line:

Code:
$ ssh -o ServerAliveInterval=10 user@remote-ssh-server-ip
 

 

0 Bình luận

Trở về
  • Setup window xp từ usb!
  • Setup window xp từ usb!

    Tôi xin chia sẻ với các bạn cách sử dụng USB để làm bộ cài đặt windows xp, giống như một đĩa...

  • Mysql command
  • Mysql command

     # [mysql dir]/bin/mysql -h hostname -u root -p Create a database on the sql server. mysql> create database [databasename]; List...