How do I prevent my SSH connection from dropping?
When my SSH connection is idle for a relatively short time, it drops. The error I get is:
end disconnect: Broken pipe
How can I prevent this from happening?
If the connection is dropping when your local machine goes to sleep, you may need to adjust a setting in your OS in order to keep network connections active while in sleep mode. The exact setting, and whether or not you can do this, will depend on the OS you're using.
That said, I recommend first trying to increase the connection timeout time in your Linode's
ClientAliveInterval 120 ClientAliveCountMax 720
sshd to check that a connection a connected client still exists every 120 seconds.
ClientAliveCountMax tells 'sshd' only to drop a connection after 720 failed checks (which, in this case, is 24 hours). With these settings, your SSH server will timeout connections only after 24 hours. Make sure to restart
sshd to apply the changes:
sudo systemctl restart ssh