Question

PuTTY gives Server unexpectedly closed network connection

Hi everyone, I have got the next notification “Server unexpectedly closed network connection” when I tried to connect to my server. I tried to solve it using recommendation from this topic https://www.digitalocean.com/community/questions/putty-gives-server-unexpectedly-closed-network-connection-why but not solved it and still can’t to connect.

Please, write information about How to Solve it. Thank you in advance!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @mslobodian1962,

A PuTTY session left idle will disconnect at a time determined by the host server. Try enabling keep-alives in PuTTY. This causes PuTTY to send null SSH packets to the remote host periodically, preventing the session from timing out.

The PuTTY client can be configured to always establish a connection which will not time out due to inactivity. To create and save a new keep-alive connection, follow these steps:

  1. Open the PuTTY application, and go to the Options panel (labeled “Category”) on the left of the window.
  2. Select (click) the “Connection” item.
  3. In the ​​"Sending of null packets to keep the session active" area on the right, change the default value of “Seconds between keepalives” from 0 (turn off) to 1800 (30 minutes).
  4. Select the “Enable TCP keepalives (SO_KEEPALIVE option)” check box. Note: This option may not be available in older versions of the PuTTY client.
  5. On the topmost left side of the Options panel, select (click) “Session”.
  6. In the “Host Name (or IP Address)” field, enter the destination host name or IP address (e.g., “destination.ipaddress.here.com” or “192.168.1.1”).
  7. In the “Saved Sessions” text-entry box, provide a name for the session (e.g., “savedsession”).
  8. Select “Save”.
  9. To use the modified session settings, select it from the “Saved sessions” list, then click the buttons marked “Load” and “Open”.

If your connected sessions still time out, enter a lower number of seconds into the “Seconds between keepalives” value.

If this doesn’t help, try using your Recovery Console and allow your IP through the firewall to SSH to your Droplet.