Enforce SSH Connections Alive

Here are a couple of option you have in order to keep the SSH connection alive

$ ssh -o ServerAliveInterval=60 <user>@<ip>

The above will instruct the ‘ssh’ client to sent “alive” packets every 60 seconds.

The following will set the same as default (by adding the option to your ssh client’s configuration file) for each ssh connection.

$echo -e "Host *\n\tServerAliveInterval 60" >> $HOME/.ssh/config