I discovered a while back that my SSH sessions weren’t staying active despite having the appropriate settings in /etc/ssh/ssh_config.

The other day, I found an article on Google with another way to get keepalive working - luckily this seems to have worked.

You need to edit ~/.ssh/config (create it if it doesn’t exist), and add the following lines:

ServerAliveInterval 300
ServerAliveCountMax 3

I restarted my terminal just for completeness and it now keeps my sessions alive 😄