How to keep PuTTY SSH Connection alive

This article describe how to keep PuTTY SSH connection alive and get rid of PuTTY session getting disconnected and timeout frequently issue if session is idle for longer time.

You might have observed that during SQL Script or shell script execution using command line, PuTTY session becomes inactive if it takes long time to execute and as a result network error and SSH connection timeout in Linux will occur.

Steps to Keep SSH PuTTY session alive

  1. Open PuTTY.
  2. Enter session details like Hostname or IP Address.
  3. click on Category and click on connection as shown below.
  4. Under Sending of null packets to keep session active, in the seconds between Keepalives, type 60. It means every 60 seconds interval SSH client will send null packet to keep SSH session alive.
  5. Now you are ready to connect. Save it and open session. Now PuTTY will never disconnect due to idle timeout.
Keep-putty-SSH-connection-alive

Again, If you are already connected and PuTTY session is disconnecting frequently then you can change the settings as mentioned below.

Right click on PuTTY left corner -> click on Change Settings -> enter 60 where seconds between keepalive is showing and save it.

Conclusion: PuTTY sessions becomes inactive if session is idle for sometime. If you are facing such issue then you need to change seconds between keepalive time so that it will continuously send null packet over SSH to keep session active.