Skip to content

SSH message No supported authentication methods available

0

I have created a new Ubuntu instance on Lightsail. I specified a custom SSH key pair that I created yesterday on Lightsail. But when I try to connect via SSH using MobaXterm, I receive this message: "No supported authentication methods available (server sent: publickey)"

None of the recommendations that I can find online are helpful:

  • I am using the correct username, as verified in the Instance info on Lightsail
  • I am using Port 22, and that port is open in the instance firewall
  • The IP address is correct, verified on the Lightsail dashboard
  • I have set MobaXterm to use the private key for the key pair that I created yesterday
  • The key pair is created for the same region as the instance
  • This is a newly created instance. I haven't changed ANYTHING on the server

I am able to connect via SSH to a different Lightsail that I created for a client using a custom key pair on MobaXterm. But this one does no work.

I appreciate any help that you can give.

2 Answers
1

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:

  1. 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.

  2. Key File Permissions: Ensure your private key file has the correct permissions (typically 400 or read-only for the owner).

  3. 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.

  4. Connection Method: Try connecting through the browser-based SSH client in the Lightsail console to verify if the instance is accessible that way.

  5. 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:

  1. Modify the security group to temporarily allow "All TCP" traffic from anywhere (0.0.0.0/0)
  2. Try connecting via SSH
  3. 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

answered 7 months ago
EXPERT
reviewed 7 months ago
0

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).

AWS
answered 7 months 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.