0

When I'm trying to connect via SSH. It was ok, but after some manipulations by me :-[ I've downloaded keypairs, copy to .ec2, chmod to 600, ssh-keygen -y -f ~/.ec2/gsg-keypair > ~/.ec2/gsg-keypair.pub I'm using MacOS. I think it's something wrong with permissions... but I've tried all combinations and all recommendations )

.ec2/ ls -l
-rw-------@ 1 olegpasko staff 1692 Apr 2 02:26 gsg-keypair
-rw-r--r-- 1 olegpasko staff 381 Apr 2 10:55 gsg-keypair.pub

.ssh/ ls -l
-rw------- 1 olegpasko staff 1766 Jun 8 2012 github_rsa
-rw-r--r-- 1 olegpasko staff 398 Jun 8 2012 github_rsa.pub
-rw------- 1 olegpasko staff 398 May 25 2012 github_rsa.pub_bak-github
-rw------- 1 olegpasko staff 1766 May 25 2012 github_rsa_bak-github
-rw------- 1 olegpasko staff 1766 Jun 28 2012 id_rsa
-rw-r--r-- 1 olegpasko staff 401 Jun 28 2012 id_rsa.pub
drw------- 2 olegpasko staff 68 Jun 28 2012 key_backup
-rw-------@ 1 olegpasko staff 5218 Apr 2 02:29 known_hosts
-rw-------@ 1 olegpasko staff 5218 Mar 31 13:55 known_hosts.bak

Trying to connect:

ssh -i gsg-keypair [email protected] -v
OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to ec2-54-247-7-28.eu-west-1.compute.amazonaws.com http://54.247.7.28 port 22.
debug1: Connection established.
debug1: identity file gsg-keypair type 1
debug1: identity file gsg-keypair-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 43:81:01:0d:a6:ff:9d:85:48:18:97:7a:12:4a:16:27
debug1: Host 'ec2-54-247-7-28.eu-west-1.compute.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/olegpasko/.ssh/known_hosts:13
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/olegpasko/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: gsg-keypair
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

:(

2
  • 'but after some manipulations by me' what manipulations? did you changed anything at /etc/ssh/sshd_config related to keypair auth?
    – Marcel
    Apr 4, 2013 at 20:50
  • yeah, manipulations is keyword... but no, I don't remember manipulations with sshd_config file :(
    – Oleg Pasko
    Apr 4, 2013 at 21:27

2 Answers 2

1
+50

You need to fix your sshd config. You can do this by following the "EBS-Backed Instances :: Instance Recovery" section of http://aws.amazon.com/instance-help/#no-response .

Step 4: "Correct the configuration on the old root volume." is where you need to un-manipulate your sshd_config.

Since instance and volume manipulation is painfully slow, you should test that your de-fubarred sshd_config works by starting an sshd on a different port using the config. Be sure the security group of the instance allows connections to that port.

1
  • Thanks! I've just unmount volume, then mount to another instance and vice versa and it works now ) And user ubuntu has appeared.
    – Oleg Pasko
    Apr 5, 2013 at 11:47
0

Assuming you're using an Amazon Linux AMI, root logins are disabled. Try ssh -i gsg-keypair [email protected] -v

8
  • Permission denied (publickey) again ( In console example with root... Connect with a standalone SSH Client... Example Enter the following command line: ssh -i gsg-keypair.pem [email protected] And it worked some days ago.
    – Oleg Pasko
    Apr 2, 2013 at 13:20
  • @ANATHEM Ah, it looks like you're using Ubuntu anyhow. Which AMI? The packager might be using a different unprivileged user name.
    – jamieb
    Apr 2, 2013 at 13:23
  • Ubuntu Server 12.04.1 LTS x64 ... I have deployer user, created previously. With deployer the same situation.
    – Oleg Pasko
    Apr 2, 2013 at 13:26
  • @ANATHEM Where did you get the AMI though? What's the ID number?
    – jamieb
    Apr 2, 2013 at 13:34
  • jamiebl, what did you mean 'where'? This is simple micro instance in eu-west-1 region, created in EC2 console :) Id is i-8c75d4c6
    – Oleg Pasko
    Apr 2, 2013 at 13:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .