title: AWS SSH Login continues to fail even with new EC2 instance [Permission denied (PublicKey)]
body: <p>I just started working with AWS to create a wordpress site on an EC2 instance (using the tutorial at <a href="https://www.youtube.com/watch?v=4WR7EFFLF04" rel="nofollow noreferrer">https://www.youtube.com/watch?v=4WR7EFFLF04</a>). Everything was working fine until I tried to add an SSL certificate using another tutorial (I can't seem to find right now).</p>
  <p>In following those steps, something broke the site (assumed DNS error) to where it wouldn't load because of too many redirects. When I went back through the tutorial to try to fix what I had done, I got to where it had me log in via SSH which I had previously done without any issues and I began getting a <em>&quot;Permission denied (PublicKey)&quot;</em> error.</p>
  <p>Since then, I haven't been able to login to that instance or any other instances without getting the same error. I've even tried creating a new instance with a brand new key and I still get that same error. Any idea what could be going on?</p>
  <p><strong>UPDATE</strong>
  I did the debug command that Flos recommended and this is the output. (is this enough to bring it &quot;on topic&quot; and reopen the question?)</p>
  <p>output:</p>
  <pre><code>OpenSSH_8.1p1, LibreSSL 2.7.3
  debug1: Reading configuration data /etc/ssh/ssh_config
  debug1: /etc/ssh/ssh_config line 47: Applying options for *
  debug1: Connecting to ec2-13-59-207-225.us-east-2.compute.amazonaws.com port 22.
  debug1: Connection established.
  debug1: identity file /Users/bradley/Desktop/John and Rhonda Wordpress Files/keypair-2.pem type -1
  debug1: identity file /Users/bradley/Desktop/John and Rhonda Wordpress Files/keypair-2.pem-cert type -1
  debug1: Local version string SSH-2.0-OpenSSH_8.1
  debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Debian-10+deb10u2
  debug1: match: OpenSSH_7.9p1 Debian-10+deb10u2 pat OpenSSH* compat 0x04000000
  debug1: Authenticating to ec2-13-59-207-225.us-east-2.compute.amazonaws.com:22 as 'admin'
  debug1: SSH2_MSG_KEXINIT sent
  debug1: SSH2_MSG_KEXINIT received
  debug1: kex: algorithm: curve25519-sha256
  debug1: kex: host key algorithm: ecdsa-sha2-nistp256
  debug1: kex: server-&gt;client cipher: chacha20-poly1305@openssh.com MAC: &lt;implicit&gt; compression: none
  debug1: kex: client-&gt;server cipher: chacha20-poly1305@openssh.com MAC: &lt;implicit&gt; compression: none
  debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
  debug1: Server host key: ecdsa-sha2-nistp256 SHA256:OiIQ5QiVxQvN9lAkjLm90ynddjDDs9L75PqDAL/cTv4
  debug1: Host 'ec2-13-59-207-225.us-east-2.compute.amazonaws.com' is known and matches the ECDSA host key.
  debug1: Found key in /Users/bradley/.ssh/known_hosts:6
  debug1: rekey out after 134217728 blocks
  debug1: SSH2_MSG_NEWKEYS sent
  debug1: expecting SSH2_MSG_NEWKEYS
  debug1: SSH2_MSG_NEWKEYS received
  debug1: rekey in after 134217728 blocks
  debug1: Will attempt key: /Users/bradley/Desktop/John and Rhonda Wordpress Files/keypair-2.pem  explicit
  debug1: SSH2_MSG_EXT_INFO received
  debug1: kex_input_ext_info: server-sig-algs=&lt;ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521&gt;
  debug1: SSH2_MSG_SERVICE_ACCEPT received
  debug1: Authentications that can continue: publickey
  debug1: Next authentication method: publickey
  debug1: Trying private key: /Users/bradley/Desktop/John and Rhonda Wordpress Files/keypair-2.pem
  debug1: Authentications that can continue: publickey
  debug1: No more authentication methods to try.
  admin@ec2-13-59-207-225.us-east-2.compute.amazonaws.com: Permission denied (publickey).
  </code></pre>