What to do if you failed to connect to your server via SSH using PuTTY and received the “Remote side unexpectedly closed network connection” error? Don’t worry, this post provides you with a solution to fix this problem.
“I'm using PuTTY to connect to our server via SSH and immediately receive the following error: Remote side unexpectedly closed network connection. What should I do?”
-Question from StackExchange
When remotely SSH into a server using PuTTY, you may fail and receive the “Remote side unexpectedly closed network connection” error. This is because if a PuTTY session is left idle, it will disconnect at a time set by the host server.
How can you fix the Remote side unexpectedly closed network connection PuTTY? The PuTTY client can be set to connect always and not time out due to inactivity. All you have to do is enable keep-alive in PuTTY. This instructs PuTTY to periodically send null SSH packets to the remote host, preventing the session from timeout.
Step 1. Open PuTTY on the client.
Step 2. Select the Session item. Enter session details such as Hostname or IP Address (e.g., "destination.ipaddress.here.com" or "192.168.1.1").
Step 3. In the Saved Sessions text-entry box, provide a name for the session (e.g., “savedsession”). Select Save.
Step 4. Choose the Connection option. Change the default value of Seconds between keepalives from 0 (off) to 1800 (30 minutes).
Step5. Check the Enable TCP keepalives (SO KEEPALIVE option).
Note: There are also three things you need to check if you still got the error after configuring the above steps:
PuTTY allows you to remotely connect to a server via SSH using commands. However, for users who are not very skilled at commands, using PuTTY is a little bit challenging. Therefore, we would like to recommend you a more intuitive and easy way to achieve remote access. AnyViewer, the free remote access software for Windows, provides you with a GUI experience and employed ECC end-to-end encryption, helping you achieve secure remote access with ease.
Besides, it is provided by a strong technical team, helping you complete a stable and fast remote connection. You’ll seldom experience a connection broken down with AnyViewer.
Step 1. On both computers, download, install, and launch AnyViewer. Go to Log in on the Controller computer, and then click Sign up. (if you have already signed up on its official website, you can log in directly).
Step 2. Fill out the signup form and you should now see that you have successfully logged into AnyViewer. Your device will be assigned to the account to which you have logged in automatically.
Step 3. Sign in with the same AnyViewer account on another device. On your local device, go to Device, click the remote computer, then click the One-click control for unattended remote access.
The remote desktop will appear once the connection is established. After that, you have complete control over it.
This post primarily introduces how to fix the “Remote side unexpectedly closed network connection” SSH error. The solution is to enable keep-alive in PuTTY. The detailed steps are listed above. If you have encountered this problem, follow the steps to troubleshoot it.
Besides, we also recommend AnyViewer to you. It is a free remote desktop software for Windows. With it, you can easily access a remote server without a connection breakdown.