I created a new instance (tiny, 64 bit AMI linux from Amazon) Created a new key pair called "mir". I downloaded mir.pem and put it in my ~/.ssh folder. I even did ssh-add mir.pem.

Then I tried to ssh ubuntu@public_DNS_from_amazon

Why doesn't it work!?

link|improve this question

2  
what does ssh -v say ? – Iain Jan 27 '11 at 21:06
1  
Also, can you do a telnet public_DNS_from_amazon 22? This would rule out the firewall. – Andrew M. Jan 28 '11 at 2:07
I'ld avoid telnet and use nmap for checking open ports: nmap -PN public_DNS_from_amazon -p 22. (-PN in case the firewall blocks ping requests) – Lekensteyn Feb 12 '11 at 11:00
1  
@Lekensteyn, there is absolutely no reason to avoid a telnet client in this case, it's perfectly fit for the job of checking ssh ports given you'll get cleartext info back in most cases. Nmap is (way) more rarely installed than telnet. – Shadok Nov 22 '11 at 15:30
feedback

9 Answers

Try ssh ubuntu@your.host.name -i your-private.key, instead of ssh-adding the key.

Oh, and make sure you allowed TCP port 22 through the Security Group.

link|improve this answer
feedback

Try using either root or ec2-user as the username.

link|improve this answer
feedback

Interesting, someone on SO asked the same. Isn't the new user called 'root' ?

link|improve this answer
3  
Not on ubuntu, it's called "ubuntu" – Tom O'Connor Jan 27 '11 at 23:53
feedback

You need to open the ssh access to you instances with a ec2-authorize default -p 22 command. Have you done this?

link|improve this answer
feedback

Does the security group (firewall configuration) allow SSH access?


I had this problem, and this thread almost helped. Once I fixed it, I wanted to fill in this almost-perfect answer.

More specifically - on the AWS management console page, select Security Groups in the left panel (towards the bottom) On the bottom-right panel, select "Inbound" tab, and make sure "Custom TCP rule" is selected. Enter 22 for the port number, click the "Add rule" button, then the "apply rule changes" button. No need to restart or reboot your instance, just need to enable TCP port 22 inbound

link|improve this answer
feedback

This has been happening to me on some of my EC2 boxes. In general, it appears that if a process is taking all the processor or is behaving badly and you get disconnected, SSH might not be able to pick up when you try to reconnect. Rebooting the box through AWS console often helps.

link|improve this answer
feedback

It is also possible to launch an instance without associating it with a keypair. You might double check that when you launched your instance, you did so with the keypair you intended. If the instance launched with the wrong keypair, you'll need to relaunch your instance.

link|improve this answer
feedback

possible duplicate of Why can't I ssh or ping my brand new Amazon EC2 instance?

Answer that worked for me was that the default installation firewall is fully locked down as per this answer http://serverfault.com/a/245917/108387

link|improve this answer
feedback

Try

ssh -i ~/.ssh/mir.pem ec2-user@xxx.xxx.xxx.xxx

where the x's are your public ip

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.