Keeping an SSH connection alive
Do you get disconnected from your SSH session often? I do... but I've found a solution that helps.
An SSH configuration that can be made on the server or client side but in my instance it makes more sense for the update to be on the client side.
~/.ssh/config we'll utilize the
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.
This declaration informs the client to send a keep alive packet at a certain interval to the server, ensuring the connection stays open.
Host example Hostname example.com ServerAliveInterval 30
That declaration will send a packet every 30 seconds if the connection goes idle. Now this is the desired funcationality that I'd like to see for all of my SSH connections so we can add it to the host wildcard like so:
Host * ServerAliveInterval 120