I have /root/.ssh folder with authorized_keys file inside of it with client public key. Root logs in fine without password by using ssh.

In case I do login with another user system reject key and asks for password.

How to setup ssh key login for simple user?


You need to be careful with permissions:

  1. Create ~/.ssh:

    $ mkdir ~/.ssh
  2. Create ~/.ssh/authorized_keys:

    $ touch ~/.ssh/authorized_keys
  3. Make sure you have the right permissions:

    • Home directory on the server should not be writable by others:

      $ chmod go-w ~
    • SSH folder on the server needs 700 permissions:

      chmod 700 ~/.ssh
    • Authorized_keys file needs 644 permissions:

      chmod 644 ~/.ssh/authorized_keys
  4. Add your key to ~/.ssh/authorized_keys. You can either add it manually or use

    $ ssh-copy-id user@host


[1] https://superuser.com/questions/215504/permissions-on-private-key-in-ssh-folder

[2] How do I add SSH Keys to authorized_keys file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.