Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I am new to EC2.

I launched an instance. 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?

1 Answer

0 votes
by (44.4k points)

Two possibilities I can think of, although they are both mentioned in the link you referenced:

You are not mentioning the correct SSH keypair file or user name in the ssh command you’re using log into the server::

ssh -i [full/path/to/keypairfile] root@[ec2-instance-dns-name or ip-address]

You might not have the proper permissions to read from the keypair file.

chmod 600 [keypair-file]

Also, try with -v option with ssh to receive more insights on how it is failing.

If everything is set up properly, this will be the output you will be seeing.

debug1: Authentications that can continue: publickey,gssapi-with-mic

debug1: Next authentication method: publickey

debug1: Trying private key: ec2-keypair

debug1: read PEM private key done: type RSA

debug1: Authentication succeeded (publickey).

Just try using -i to list all the problems. And also use the complete path to eliminate all path problems. 

Related questions

0 votes
1 answer
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...