Learn how to prevent connections from closing after an idle time in PuTTY.

How to prevent connections from closing after a while in PuTTY

As someone that has to code on a project, then update the changes on the production server, change some configuration on the server remotely via SSH, i know how tedious it is when the SSH connection via PuTTY gets interrupted and suddenly it isn't available anymore, showing the error "PuTTY Fatal Error, Network Error: Software caused connection abort", so you need to connect once again, providing your password manually if you don't use PageAnt.

To solve this problem all i had to do was to enable the TCP Keepalives and increase the seconds between the keepalives like this. As first, start the PuTTY application and load your connection session:

PuTTY Load Session Connection

Then go to the Connection node of the treeview, in this view under "Sending of null packets to keep session active", in the Seconds between keepalives, type 30 and check the Enable TCP Keepalives (SO Keepalive option):

KeepAlive SSH Connection PuTTY

It's worth to mention that keepalives are not always helpful, for example, they will help you if you have a firewall that drops your connection after an idle time, but, if the network between you and the server breaks in connectivity, then the keepalives can actually make the things worse. The will be no issue only, if the session is idle and the connectivity is temporarily lost between both endpoints, but the connectivity is restored before both sides try to send any kind of information.

Keepalives are only supported in Telnet and SSH; the Rlogin and Raw protocols offer no way of implementing them.

Happy coding ❤️!

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.