ssh prompts for password despite .ssh/authorized_keys

I found the solution based on @jasonwryan comment under my question.

There was #AuthorizedKeysFile /usr/NX/home/nx/.ssh/authorized_keys2 in the /etc/ssh/sshd_config sshd config file. Changing the entry to standard AuthorizedKeysFile .ssh/authorized_keys solved the issue.


In the past, I came across some tutorials that describe how to achieve a ssh password-less setup but some are sadly wrong.

Let's start over again and check every step:

  1. FROM CLIENT - Generate key: ssh-keygen -t rsa

    • Public and private key (id_rsa.pub and id_rsa) will be automatically stored in the ~/.ssh/ directory.
    • Setup will be easier if you use an empty passphrase. If you are not willing to do that, then still follow this guide, but also check the bullet point below.

  2. FROM CLIENT - Copy public key to server : ssh-copy-id user@server

    • Client public key will be copied to server's location ~/.ssh/authorized_keys.

  3. FROM CLIENT - Connect to server: ssh user@server

Now, if it's still not working after the described 3 steps, let's try the following:

  • Check ~/ssh folder permissions in client and server machine.
  • Check /etc/ssh/sshd_config in the server to ensure that RSAAuthentication, PubkeyAuthentication and UsePAM options aren't disabled, as they are enabled by default with yes.
  • If you entered a passphrase while generating your client key, then you may try ssh-agent & ssh-add to achieve password-less connections in your session.
  • Check the contents of /var/log/auth.log on the server to find the issue why key authentication is skipped at all.