I need SSH access to an Amazon EC2 instance running Ubuntu 10.4. All I have is the Amazon username and password. Any ideas?
I Accepted AWS offer to use the default security groups which included 'All Trafic' ports.
And, after many and many times trying to connect on my new ec2 instance, I just realized that I should edit my used security group and manually add to inbound and outbound the 22 port ( ssh ) !
Hope it helps !
If you are using MacOS, you should create/edit SSH configuration file (~/.ssh/config) and put something like:
Host *.amazonaws.com
User ubuntu
Port 22
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
IdentityFile ~/PATH/YOUR_DOWNLOADED_KEY.pem
Then to connect to any of EC2 instances:
ssh MYNAME.amazonaws.com
Nothing more!
Doing what is suggested in all these answers is not enough. Against each instance you see a security group. When you launch a new instance, you will have this thing set to default. You need to edit the security group and add the ssh port it. Later you need to add the 8080, 8443, 80, 443 ports also when you want to host your website.
ssh -i /path/to/private-key ubuntu@<ec2-public-dns-address>
just use ubuntu
instead of root
. Your problem will be solved.
Cheers!
Not logging in as the correct user for you OS Distro could be the issue. For certain new AMI, the username may not be "ubuntu", but "ec2-user". For Amazon Linux, for instance I believe the user is "ec2-user". Eric Hammond gives examples here: http://alestic.com/2014/01/ec2-ssh-username
My suggestion, try:
ssh -i /path/to/file.pem ec2-user@ec2...
ssh -i /path/to/file.pem ubuntu@ec2...
ssh -i /path/to/file.pem root@ec2...
If you have the wrong AMI, you might just want to restart the machine altogether so you have uniformity amongst your clusters. If this is your problem, you'll probably want the same OS Distro's at least for your linux boxes.
First change permission of pem file by
chmod 400 path/to/key_pair.pem
Inside the file ~/.ssh/config add the following lines, at the top of the file
Host AWS
Hostname myserver.com
User myuser
IdentityFile path/to/.pem/file
port 22
Hostname take IP or link of server, User take username of server and Identity file is file downloaded from AWS when you created instance. Just Run the following command in terminal
ssh AWS
and enjoy it!
Note: To navigate into .ssh
folder. First press Ctrl + H
in home folder to display all the hidden files and finally cd .ssh