title: SSH Permission denied (publickey)
body: <p>I'm trying to SSH into a Debian from Ubuntu. I already have a RSA key; it's the same key that I use got my Git.</p>
  <p>I copied the key from Ubuntu to Debian using:</p>
  <pre><code>ssh-copy-id -i ~/.ssh/id_rsa.pub root@ip-address
  </code></pre>
  <p>Then I modified <code>sshd_config</code> on Debian to include the following:</p>
  <blockquote>
  <p>RSAAuthentication yes</p>
  <p>PubkeyAuthentication yes</p>
  <p>PasswordAuthentication no</p>
  </blockquote>
  <p>And I restarted my SSH service. Now I try to SSH into from Ubuntu using</p>
  <pre><code>ssh -v root@ip-addr
  </code></pre>
  <p>but I get the following:</p>
  <pre><code>OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
  debug1: Reading configuration data /etc/ssh/ssh_config
  debug1: /etc/ssh/ssh_config line 19: Applying options for *
  debug1: Connecting to 10.0.1.64 [10.0.1.64] port 22.
  debug1: Connection established.
  debug1: identity file /home/koushatalebian/.ssh/id_rsa.pub type 1
  debug1: identity file /home/koushatalebian/.ssh/id_rsa.pub-cert type -1
  debug1: Enabling compatibility mode for protocol 2.0
  debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-8
  debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u2
  debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH* compat 0x04000000
  debug1: SSH2_MSG_KEXINIT sent
  debug1: SSH2_MSG_KEXINIT received
  debug1: kex: server-&gt;client aes128-ctr hmac-md5 none
  debug1: kex: client-&gt;server aes128-ctr hmac-md5 none
  debug1: sending SSH2_MSG_KEX_ECDH_INIT
  debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
  debug1: Server host key: ECDSA e2:af:83:f8:df:e2:15:db:77:30:e1:6b:e7:dc:77:99
  debug1: Host '10.0.1.64' is known and matches the ECDSA host key.
  debug1: Found key in /home/koushatalebian/.ssh/known_hosts:10
  debug1: ssh_ecdsa_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: /home/koushatalebian/.ssh/id_rsa.pub
  debug1: Authentications that can continue: publickey
  debug1: No more authentication methods to try.
  Permission denied (publickey).
  </code></pre>
  <p>I'm basically want to force SSH to only occur through publickey authentication.</p>
  <p>I've read every other post related to this topic, and none of them worked for me. That is why I've created this as a separate post.</p>
  <p><strong>EDIT</strong></p>
  <p>Changing <code>StrictModes</code> from <code>yes</code> to <code>no</code> in <code>sshd_config</code> fixed the problem. Is this safe to do?</p>
  <p><strong>EDIT 2</strong>
  This is the log for the SSH on the server:</p>
  <pre><code>May  5 18:23:55 lemaker sshd[2591]: Connection from 10.0.1.37 port 42748
  May  5 18:23:55 lemaker sshd[2591]: debug1: PAM: setting PAM_RHOST to &quot;10.0.1.37&quot;
  May  5 18:23:55 lemaker sshd[2591]: Failed publickey for root from 10.0.1.37 port 42748 ssh2
  May  5 18:23:55 lemaker sshd[2591]: Connection closed by 10.0.1.37 [preauth]
  </code></pre>