Amazon Lightsail Log in failed – CLIENT_UNAUTHORIZED

When trying to log in to Amazon Lightsail instance, I got the error

Amazon Lightsail connect failed

This lightsail refused to connect error happens because when you update the system, you replaced the default /etc/ssh/sshd_config file provided by Amazon AWS.

To fix the error, connect to the Lightsail server using SSH (terminal on Linux/Mac, putty on windows), edit the file

At the end of the file, add the following 2 lines

Restart ssh service

Now you should be able to login to Amazon Lightsail using AWS Console.

If your file is corrupted, you can recreate it with the command

Method 2: Reover with shapshot

If you can’t SSH into the server using putty or a terminal, you need to take a snapshot of the server. Create a new lightsail server based on the snapshot. During the new server creation, you have the option to reset the PEM file. You can also enter a startup script, that gets executed when the server is started the first time.

Use the following startup script

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *