jmontross
jmontross

Reputation: 3581

Why does ec2 asks for password when i use an identity file?

I use the following command and i got the code from http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

ssh -i my-key-pair.pem [email protected]

I'm not sure if it's because I lost the .pem file and recreated it or what is going on here, but no matter if I use the user ubuntu, root, or ec2-user the terminal asks me for a password.

Upvotes: 0

Views: 516

Answers (3)

jmontross
jmontross

Reputation: 3581

You have to terminate the instance and copy it with a new ssh key. If a key is lost then access to the server is also lost.

Upvotes: 0

Barak
Barak

Reputation: 3066

Double-check the file permissions on your key file. Do:

chmod 400 my-key-pair.pem

and try again.

It is also likely that the key file is just the wrong one.

Upvotes: 1

dhinson919
dhinson919

Reputation: 61

Your local private key must be shrouded as it should be. It can be disabled with key management tools if you really want, but not advised.

Upvotes: 1

Related Questions