Skip to content
Linux Heart.
← Back to the archive

PuTTY keep-alive: stopping idle connections from freezing

Guide revisited November 14, 2026

Start with the client setting

The useful clue in my old router story is the repeatable idle interval. If a connection works while you type but stops responding after the same quiet period, a device on the route may be expiring its connection record. That is a different problem from a slow shell during active work.

In PuTTY, open Connection and set Seconds between keepalives to a nonzero interval shorter than the observed cutoff. Load and save the relevant session so the setting applies next time. The 25-second value in my original note was a choice for that network, not a universal default. Compare otherwise similar idle sessions before changing additional settings.

A useful check is to leave the session idle longer than the old cutoff and then type a command. If it still fails, compare a different network route and inspect the server’s connection policy; do not assume that every disconnect is a router timeout. Keepalives cannot repair an actual outage and can make a temporary break visible sooner.

The four server settings below are preserved as part of the original account. They are not a bundle that every SSH server needs: UseDNS concerns name lookup rather than keeping an established terminal active. If you administer the server, inspect its effective policy and validate any proposed configuration before reloading it, keeping an existing connection available.

Reference: PuTTY’s keepalive documentation.

Original note

PuTTY icon
PuTTY icon by Simon Tatham and Jacob Nevins · MIT license.

Moving abroad changed more than my state of mind; it changed my home network topology too 🙂 2 laptops, a network multifunction printer (printer, copier, scanner, fax and goodness knows what else), a DSL modem, a router, and my trusty PuTTY terminal as usual. Everything would have been fine if the thing hadn’t stopped responding to keystrokes after 5-6 idle minutes. How do you deal with that little joy? It’s simple. In PuTTY’s Connection settings, set “Seconds between keepalives” to 25. Then edit your server’s SSH config (for example /etc/ssh/sshd_config) and change the following parameters:

ClientAliveInterval 180
ClientAliveCountMax 3
UseDNS no
TCPKeepAlive yes

Then enjoy. Unsurprisingly, the culprit was the Linksys Wi-Fi router, which was quietly dropping connections after a certain period of inactivity.
Thanks to Zolotko for the tip.

Leave a Comment