简体   繁体   中英

Amazon AWS EC2 Instance - Can't connect with SSH

This shouldn't be this hard. I cannot connect to new AWS EC2 instance via SSH clients. I am connecting from a Win 7 box.

Instance OS: Debian 6

AMI: debian-squeeze-i386-20121119-e4554303-3a9d-412e-9604-eae67dde7b76-ami-1977f070.1(ami-a121a6c8)

User: tried root and also ec2-user

Using .pem keypair that AWS generated and I downloaded

Confirmed security group and Key Pair Name on instance

SSH port 22 is OPEN: Nmap says so and Telnet gets a welcome reply

Using 3 different clients: all clients connect ok

PuTTY replies: Server refused our key

MindTerm Java browser add-in replies: Authentication failed, permission denied

Bitvise SSH replies: Attempting 'publickey' auth; auth failed; Attempting 'publickey' auth; auth failed;

Rebooted instance, wash, rinse, repeat...

REBUILT new instance and new keypair, wash, rinse, repeat...

Connecting isn't the issue. Why would the instance not accept the .pem file as the password? Is there an additional step I am missing? I followed EVERY frigging guide I could Google. AWS support is a joke. stackoverflow to the rescue...

TIA.

根据你正在使用的AMI文档的debian wiki ,你需要用来登录的用户名是'admin'。

I have had many issues with connecting to EC2 via ssh.

ssh -i the-keypair-filename root@yourdomain.com

- Keypair file must be in same directory. - I just used terminal to connect.

Make sure you generate or assign the keypair when launching the instance.

Also you can verify the keypair you have set in the AWS Management Console, this is done by selecting the running instance and then looking for "Key Pair Name:".

I hope this is helpful.

My problem was that I didn't add a volume that was expected in the fstab file so the server didn't start fully and the sshd daemon wasn't running.

Check with:

    telnet HOST 22

Check the server logs to make sure it starts properly before you waste lots of time like I did.

Amazon Linux AMIs that use ec2-user password are listed at the bottom of this page.

http://aws.amazon.com/amazon-linux-ami/

Check that you are using one of those if trying to use ec2-user, or check the documentation for the AMI you are using.

Teri

尝试使用“admin”用户名并忽略亚马逊建议的用户名。

I had the similar problem and I have solved the issue by following approach.

1) Edited the knife.rb file in my chef folder ie :\\Users\\Administrator\\chef-starter\\chef-repo.chef\\knife.rb as bellow:

knife[:aws_access_key_id]     = "xxxxxxxxxxxxxxxxxxxx"
knife[:aws_secret_access_key] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
knife[:region]                = 'ap-southeast-1'
knife[:aws_ssh_key_id] = "ChefUser"
knife[:ssh_user]="ec2-user"

In the command prompt, issued the command to create an ec2-server:

knife ec2 server create -r "role[webserver]" --image ami-abcd1234 --flavor t1.micro -G  ChefClient -x root -N server01 -i H:\Chef-files\ChefUser.pem

Note that, even though I had given all the details in the knife.rb file, I had to give the .pem file path in coomand line through -i option. That solved my problem.

Check, if the solution of mine helps you.

Cheers,

Chandan

Logging in as "ubuntu" worked for me:

ssh -i private_key.pem ubuntu@myubuntuserver

Hope this helps

--Erin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM