views:

1138

answers:

3

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?

Thanks,

Josh

+1  A: 

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

  1. You're not specifying the correct SSH keypair file or user name in the ssh command you're using to log into the server:

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

  2. You don't have the correct permissions on the keypair file; you should use

    chmod 600 [keypair file]

to ensure that only you can read or write the file.

Try using the -v option with ssh to get more info on where exactly it's failing, and post back here if you''d like more help.

[Update]: OK, so this is what you should have seen if everything was set up properly:

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).

Are you running the ssh command from the directory containing the ec2-keypair file ? If so, try specifying -i ./ec2-keypair just to eliminate path problems. Also check "ls -l [full path to ec2-keypair]" file and make sure the permissions are 600 (displayed as rw-------). If none of that works, I'd suspect the contents of the keypair file, so try recreating it using the steps in your link.

gareth_bowles
Here is the specific info regarding the error:debug1: Authentications that can continue: publickey,gssapi-with-micdebug1: Next authentication method: publickeydebug1: Trying private key: ec2-keypairdebug1: read PEM private key done: type RSAdebug1: Authentications that can continue: publickey,gssapi-with-micdebug1: No more authentication methods to try.Permission denied (publickey,gssapi-with-mic).
resonantmedia
I edited my answer to add more info, as there isn't room to put it in a new comment.
gareth_bowles
I checked that. I have two keypairs one for one site and another for another site. I can use the same keypair that is causing problems on another instance without problem. Could the problem be with this specific instance? Thank you for your help.
resonantmedia
Any other ideas? I really need this to work.
resonantmedia
Sorry, I'm stuck now, especially as you just mentioned that you can connect to other instances without problems. It might be worth checking your instance via the AWS Management Console at https://console.aws.amazon.com - you can double-check the keypair and also look at the system log to make sure that the instance booted successfully.
gareth_bowles
A: 

I'm having the same issue. I can connect to an existing amazon instance with no problem. If I relaunch from the same ami, I can connect but if I launch a new ami (I've tried several ubuntu and fedora ami's) I get the same permission denied error. When I try to access the system log from the aws console, its blank. I've been trying to resolve this problem for 3 days with no success.

Chris Barnes