title: EC2 keypair works in one instance but fails on other - Permission denied (publickey)
body: <p>I have read many posts on this subject but none helped me solve my issue.</p>
  
  <p>I have a machine amazon ec2 which I connect using this SSH command:</p>
  
  <pre><code>ssh -i /Library/AWS/glrpopulis.pem ec2-user@54.225.154.23
  </code></pre>
  
  <p>I've never had problems with this command until now. It just stopped working, the following message is displayed: <em>Permission denied (publickey).</em> out of nowhere!</p>
  
  <p>I really can't understand why suddenly the same command I use almost everyday is failing to work. Probably I've changed something I wasn't supposed to, but I'm having a really hard time figuring out what.</p>
  
  <p>I was creating a service for a web application (atlassian bamboo) when that happened the first time, but I'm not sure if this relates to the error.</p>
  
  <p>I have reboot the machine a couple of times and tried over and over again, with no success.</p>
  
  <p>The complete output with the -v option is displayed bellow:</p>
  
  <pre><code>mac-pipo:~ felipereis$ ssh -v -i /Library/AWS/glrpopulis.pem ec2-user@54.225.154.23
  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 54.225.154.23 [54.225.154.23] port 22.
  debug1: Connection established.
  debug1: identity file /Users/felipereis/.ssh/id_rsa type 1
  debug1: identity file /Users/felipereis/.ssh/id_rsa-cert type -1
  debug1: identity file /Users/felipereis/.ssh/id_dsa type -1
  debug1: identity file /Users/felipereis/.ssh/id_dsa-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_6.2
  debug1: match: OpenSSH_6.2 pat OpenSSH*
  debug1: SSH2_MSG_KEXINIT sent
  debug1: SSH2_MSG_KEXINIT received
  debug1: kex: server-&gt;client aes128-ctr hmac-md5-etm@openssh.com none
  debug1: kex: client-&gt;server aes128-ctr hmac-md5-etm@openssh.com none
  debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024&lt;1024&lt;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 19:ef:f1:2b:56:dd:86:ec:42:65:ff:1d:6b:64:0f:f3
  debug1: Host '54.225.154.23' is known and matches the RSA host key.
  debug1: Found key in /Users/felipereis/.ssh/known_hosts:12
  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/felipereis/.ssh/id_rsa
  debug1: Authentications that can continue: publickey
  debug1: Offering RSA public key: /Library/AWS/glrpopulis.pem
  debug1: Authentications that can continue: publickey
  debug1: Trying private key: /Users/felipereis/.ssh/id_dsa
  debug1: No more authentication methods to try.
  Permission denied (publickey).
  </code></pre>
  
  <p>UPDATE:
  * I have just tested and I'm able to use the same key (glrpopulis.pem) to connect to a different ec2 instance, so maybe is something going on the first machine</p>