- Newest
- Most votes
- Most comments
This error message "No supported authentication methods available (server sent: publickey)" indicates that the SSH server on your Lightsail instance is only accepting public key authentication, but there's an issue with the key you're using.
Here are some potential causes and solutions:
-
Key Pair Mismatch: The most common cause is that the private key you're using doesn't match the public key installed on the instance. Double-check that you're using the exact key pair that you specified when creating the instance.
-
Key File Permissions: Ensure your private key file has the correct permissions (typically 400 or read-only for the owner).
-
Host Key Validation: If you've recently recreated an instance with the same IP address, there might be a host key mismatch. In the Lightsail console, you might need to use the "Reset record" option if prompted with a host key mismatch error.
-
Connection Method: Try connecting through the browser-based SSH client in the Lightsail console to verify if the instance is accessible that way.
-
Security Group/Firewall: While you mentioned port 22 is open, double-check that the security group allows SSH connections from your specific IP address.
If you continue experiencing issues, you could try this workaround that has helped others:
- Modify the security group to temporarily allow "All TCP" traffic from anywhere (0.0.0.0/0)
- Try connecting via SSH
- If successful, revert back to just allowing SSH on port 22
As a last resort, you might need to create a snapshot of your instance and launch a new instance from that snapshot with a new key pair.
Sources
Resolve connection errors with Lightsail browser-based SSH and RDP clients - Amazon Lightsail
SSH not working on fresh account, | AWS re:Post
SSH Access Issue – Permission Denied (publickey) for Ubuntu EC2 Instance | AWS re:Post
Given the message you're receiving (when you are trying to provide the matching private key) I would run ssh -vvv to get extremely verbose output. This diagnostic information can reveal more about the cause of your connection failure.
One frequent issue when downloading a private key from the internet, is group and system readable permissions on the private key file. Many tools reject a private key with permissions that aren't equivalent to chmod 600 (user-only read-write).
Relevant content
- asked 2 years ago

I am trying to access my instance using MobaXTerm running on Windows 11. I could try connecting via ssh from a server, to see if I can get a verbose message.
Since this is an application running on Windows, file permissions is not the problem. I might try creating my own key pair in another way, instead of doing it through AWS, then uploading it. I still don't understand why I can access another Lightsail instance with a different key pair without a problem.