The default setting on many SSH servers is to disconnect clients who have been inactive for a set period of time. If you ever left an SSH client running without interacting with it for a while, only to find a message such as Connection reset by peer, then this is likely the cause. I find the easiest way to prevent this is to configure your SSH client to send a null packet to the SSH server, almost like a heartbeat. Edit your ssh_config file setting ServerAliveInterval to:
ServerAliveInterval 60
and ServerAliveCountMax to
ServerAliveCountMax 3
ServerAliveInterval tells your SSH client to send a message every 60 seconds to the SSH server thereby preventing the server from disconnecting you for being idle. I chose the value of 60 but you can increase or decrease this as required. ServerAliveCountMax is the number of times to send the null packet and receive no response, before giving up.

This was posted on Wed 25 Jun 2014 (4 years, 8 months ago) by Ryan McConville
Tags: Tech Notes