Does this error occur while you are connecting to your instance? If yes, then don’t worry, we will help you resolve it. Read on this blog to know how you can resolve this error like a pro!
If you are connecting to your instance with Putty and receive the error “Server unexpectedly closed network connection”, then you can resolve it with two solutions and we are going to discuss these two solutions in this blog.
This is the error –
If this error message appears, there are possibilities that
- You are not using the correct username when connecting to your instance
- You are not using the correct key when connecting to your instance”
- PuTTy options –> Connection problem
- You have accidently applied Chmod 777 on root folder
Since it might be an SSH issue, we have found the following link on troubleshooting problems which will help you in connecting to your instance: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-ssh-troubleshooting/
You can try connecting again by entering your correct username because it is possible that you had entered the wrong username before. Try this and see if it works.
Just like this, try connecting again by entering the correct key and see if it works.
If both of these don’t work, then you need to try these two solutions for connecting to your instance. Let’s see what these solutions are and how they work.
Here is the first solution for you that can help you resolve this error
Go to PuTTy options –> Connection
- Change the default value for “Seconds between keepalives(0 to turn off)” : from 0 to 600 (10 minutes) — in my case taking 30 secound That means it sends a “ping” every 30 seconds to prevent the connection from timing out
- Check the “Enable TCP_keepalives (SO_KEEPALIVE option)” check box.
- Finally save setting for session
Youtube Video – https://www.youtube.com/watch?v=cFP4AsxvwNQ&feature=youtu.be
Here is the 2nd solution to resolve this error
It might be possible that you have put Chmod 777 to remove chmod 777 permission on root folder.
If you just want to remove the write permission to others, the command is given below and it has to be done from the root folder: chmod o-w /
This will remove others permission from / (root folder)
* o means others.
* w means write permissions.
So o-w means remove write permission from others. You can also read online to know how this exactly works and how the permissions can be updated for linux.
Here are some of the references to Forums and documents:
Whenever such error appears, these two solutions can be helpful for you to resolve the error and you will able to connect to your instance easily. So, if you come across this error, follow these two solutions and say goodbye to the error in a few minutes.
We hope you resolve this error successfully with the help of this blog. (Metizsoft Solutions Private Limited)