These settings can be made either - System wide in the file "/etc/ssh_config"
- Per user in the file "~/.ssh_config"
- Passing options via the command line using the -o option
The configuration file for ssh client is /etc/ssh/ssh_config. You can open it with your favorite editor Note: this file will set the option server wide. If you want just to set it for particular user create .ssh_config file in the home directory of the user. There are two configuration options that have to be set in order to implement keep-alive on ssh from client side.
ServerAliveInterval - sets an interval in seconds. If no data is received from server for specified time ssh will send a message through the encrypted channel and will request a response from the server.
ServerAliveInterval 60
The second option is ServerAliveCountMax. It sets the max attempts that ssh client will send keep-alive packets to the server. If no response is received from server side for the specified count of messages the connection is closed automatically by the client.
ServerAliveCountMax 3
autossh
tries to keep an ssh connection active.. if it disconnects it will automatically restart the connection
|