Prevent SSH from disconnecting idle sessions

Prevent SSH from disconnecting idle sessions

If you leave PuTTY connected for long periods of time (especially on tail -f /some/log/file) you may have noticed the SSH server disconnects you after a while if there is no new input on that log file.

You could configure PuTTY to enable connection keepalive functionality, but you’d need to either do that for every session or every saved server in the list.

The easier way is to enable this functionality on the servers themselves, by editing the /etc/ssh/sshd_config file and adding/editing this line:

clientaliveinterval 60

This will make the server send a keepalive packet every 60 seconds, preventing the disconnection of idle sessions.

Leave a Reply