AWS ubuntu instance connection error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

Viewed 24

I created an Ubuntu Instance in AWS.

I created public key, and downloaded .pem file

and tried to ssh connect with vscode.

I wrote .ssh config file as follows.

Host AWS
    HostName 13.125.226.*** 
    IdentityFile the absolute local address that .pem file located (starts with /Users)
    User ubuntu

But error occurs

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

What solutions will help?

(When I opened .pem file o I created on AWS, "An error has occurred. Unable to import items." message appears (on mac). Would this additional info help?)

1 Answers

I solved the issue with changing User value in config file. Since it is Amazon Linux, User should be ec2-user, not ubuntu.

Host AWS
    HostName 13.125.226.*** 
    IdentityFile the absolute local address that .pem file located (starts with /Users)
    User ec2-user
Related