0 votes
1 view
in AWS by (19.2k 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.6k 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] [email protected][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. 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...