Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!?

share|improve this question
3  
what does ssh -v say ? –  Iain Jan 27 '11 at 21:06
2  
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
    
possible duplicate of serverfault.com/questions/245916/… Answer that worked for me was that the default installation firewall is fully locked down as per this answer serverfault.com/a/245917/108387 –  Richard Le Mesurier Jan 26 '12 at 11:34

8 Answers 8

To login to your AMI box you use the ec2-user. This means you would use the following to login: ssh -i mir.pem ec2-user@public_dns to login.

share|improve this answer

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

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

share|improve this answer
    
This answer did the trick for me. Also, since my instance run Ubuntu replace 'root' with ubuntu. Here's the line I connect with from the terminal: ssh -i ec2vpnkey.pem ubuntu@exxxxxxxxxx.compute-1.amazonaws.com –  user128280 Jul 14 '12 at 4:55

Try

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

where the x's are your public ip

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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

share|improve this answer

protected by EEAA Jul 14 '12 at 5:18

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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