title: ssh passwordless login fails with permission denied (publickey)
body: <p>I am trying to set up passwordless ssh on two fresh linux VM's from VM A to VM B but I'm having permissions issues. I installed openssh-server on both vm's and configured /etc/ssh/sshd_config as follows: </p>
  
  <pre><code>RSAAuthentication yes
  PubkeyAuthentication yes
  #AuthorizedKeysFile     %h/.ssh/authorized_keys
  PasswordAuthentication no
  </code></pre>
  
  <p>All other fields are their default values. On VM A I ran <code>ssh-keygen -t rsa</code> with the default options. I tried to use <code>ssh-copy-id</code> but I got a permission denied(publickey) error. I then manually copied id_rsa.pub into authorized_keys on VM B. I used <code>chmod 700</code> for ~/.ssh, <code>chmod 600</code> for ~/.ssh/id_rsa, and <code>chmod 644</code> for ~/.ssh/id_rsa.pub, ~/.ssh/authorized_keys, and ~/.ssh/known_hosts on both VM's. After running ssh -v VM-B I get the following output:</p>
  
  <pre><code>OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
  debug1: Reading configuration data /etc/ssh/ssh_config
  debug1: /etc/ssh/ssh_config line 19: Applying options for *
  debug1: Connecting to hadoop-slave-1 [192.168.86.134] port 22.
  debug1: Connection established.
  debug1: identity file /home/hduser/.ssh/id_rsa type 1
  debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
  debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
  debug1: identity file /home/hduser/.ssh/id_rsa-cert type -1
  debug1: identity file /home/hduser/.ssh/id_dsa type -1
  debug1: identity file /home/hduser/.ssh/id_dsa-cert type -1
  debug1: identity file /home/hduser/.ssh/id_ecdsa type -1
  debug1: identity file /home/hduser/.ssh/id_ecdsa-cert type -1
  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*
  debug1: Enabling compatibility mode for protocol 2.0
  debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
  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 45:48:fd:f0:db:1a:2a:c0:80:17:ec:18:5a:dd:f2:a5
  debug1: Host 'hadoop-slave-1' is known and matches the ECDSA host key.
  debug1: Found key in /home/hduser/.ssh/known_hosts:1
  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/hduser/.ssh/id_rsa
  debug1: Authentications that can continue: publickey
  debug1: Trying private key: /home/hduser/.ssh/id_dsa
  debug1: Trying private key: /home/hduser/.ssh/id_ecdsa
  debug1: No more authentication methods to try.
  Permission denied (publickey).
  </code></pre>
  
  <p>Is there something else I need to do?</p>