Permissions error when connecting to EC2 via SSH o

2020-05-14 18:51发布

I am new to EC2. I created my security credentials from this site:

http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2

It worked great, I rebooted and now when I try to connect I get a login/password prompt. (Which I never set up.) After several attempts I get this error:

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

What am I doing wrong?

15条回答
相关推荐>>
2楼-- · 2020-05-14 19:43

After about a half hour of searching and trying to debug this I was able to figure it out. My situation involved me using the same pem file for two different ec2 instance and it working for one and not the other.

My first instance it worked on was the standard aws linux ami amzn-ami-hvm-2014.03.2.x86_64-ebs. I simply used

ssh -i mypemfile.pem ec2-user@myec2ipaddress 

and it worked.

I then launched a fedora instance Fedora-x86_64-19-20140407-sda and tried the same command but kept getting:

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

After changing my username from ec2-user to fedora it worked!

ssh -i mypemfile.pem fedora@myec2address
查看更多
Fickle 薄情
3楼-- · 2020-05-14 19:45

None of the above helped me, but futzing with the user seemed like it had promise. For my config using 'ubuntu' was right.....

ssh -i [full path to keypair file] ubuntu@[EC2 instance hostname or IP address]

查看更多
可以哭但决不认输i
4楼-- · 2020-05-14 19:47

I was able to login using ec2-user

ssh -i [full path to keypair file] ec2-user@[EC2 instance hostname or IP address]

查看更多
登录 后发表回答