0

Struggling with a common problem. The awkward thing is I have followed the guide linked below with success before and I have fully established a working Amazon Web Services LAMP stack running Ubuntu and referencing an RDS database instance.

Here is my problem in this particular scenario, referencing this guide:

http://jeffreifman.com/detailed-wordpress-guide-for-aws/secure-your-instance/

  • Launched m1. Micro Instance running Ubuntu 12.04 LTS 64bit.
  • Created AWS security keys, downloaded private key to ~/.ssh folder
  • SSH in using private key and root login
  • Created new admin user
  • Added admin user to admin group
  • Added user to sudoers list
  • Changed user to new user
  • Generated new security keypair
  • Added new security keypair to authorized_keys list
  • Set permissions for .ssh folder to 600
  • Edited sshd_config to allow users from ubuntu and new user
  • restarted SSH service
  • SFTP downloaded private key from tmp folder on server
  • .ssh remote folder permissions currently set to 700. Private key to 400, Public key to 600.
  • local ~/.ssh/ private key permissions set to 600.

At this point, I have tried SSH'ing back into the server under newuser@my.ip.address referencing the new private key and I am given the 'permission denied (public key)' warning.

Any help with resolving this would be greatly appreciated.

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to my.ip.address [my.ip.address] port 22.
debug1: Connection established.
debug1: identity file /Users/myfiles/.ssh/my_key type -1
debug1: identity file /Users/myfiles/.ssh/my_key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-    5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
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 my.pub.key
debug1: Host '54.72.105.9' is known and matches the RSA host key.
debug1: Found key in /Users/lloyd/.ssh/known_hosts:6
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 DSA public key: /Users/lloyd/.ssh/id_fkadmin
debug1: Authentications that can continue: publickey
debug1: Offering DSA public key: /Users/lloyd/.ssh/id_nutriciaadmin
debug1: Authentications that can continue: publickey 
debug1: Trying private key: /Users/lloyd/.ssh/id_nutriciaadmin
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Lloyd Rees
  • 85
  • 1
  • 5

1 Answers1

0

You need to tell your local machine which key to use now. You can add it at a root level, but if you have both keys added, it will simply try both of them. The preferred method is to create a conf file for ssh

  1. touch ~/.ssh/config then add in

    Host [remote-ip-address]
       IdentityFile    [path to pem file (must be chmod 600)]
       User            [login user]
    
  2. If that still fails, try debugging the actual ssh connect to see what it's trying to use.

    ssh -v [user@host]

comjf
  • 156
  • 3
  • Hi, thanks for the above but this doesn't seem to work. I have attached my debug log above. Any additional help would be appreciated. Cheers. – Lloyd Rees Apr 08 '14 at 06:45