PuTTY Fatal Error: Remote side unexpectedly closed network connection
“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
How to fix the “Remote side unexpectedly closed network connection”error
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:
- If the firewall were to block the connection, it would time out. Make sure the firewall is turned off.
- If the port forwarding is not set up correctly, for example, if you specify the wrong port, it would time out.
- If you connect to the wrong hostname or IP address, it would time out.
Bonus tip: Remote into a Windows server without error
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, helping you achieve 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.
Step 3. 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 4. Sign in with the same AnyViewer account on both computers, then click the One-click control for unattended remote access.
Step 5. The remote desktop will appear once the connection is established. After that, you have complete control over it.
- It is recommended to upgrade your account to a Professional or Enterprise plan. What can a professional or enterprise plan brings to you:
- More devices can be assigned to the same account for unattended remote support.
- Connect in privacy mode to protect your privacy. This means the Controller can black out the remote PC screen and disable the remote keyboard and mouse click.
- File transfer speed will be increased. Transfer speed is 500 KB/s for a free account and up to 10 MB/s for a paid account.
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.