I have Raspbmc installed and I'm trying to get passwordless ssh working. I've copied over my public key, put is in ~/.ssh/authorized_keys2, and set the permissions to 600. However, I'm still getting prompted for my password. Anybody know what's up?

  • 1
    Did you follow a specific tutorial? Try this, just do it all again. It should work. Did you run into any errors along the way? debian-administration.org/articles/152.
    – Impulss
    Commented Jan 22, 2013 at 3:58
  • 2
    Try running ssh with the one fo the flag -v, -vv, or -vvv (increased verbosity) to see more of what is going on.
    – Frepa
    Commented Jan 22, 2013 at 10:14
  • Yes. Look at my answer below. No need to mess with the guts yourself. Let the commands do it. There are only two of them, and it sounds like you have already done the first.
    – SDsolar
    Commented May 2, 2017 at 19:28

3 Answers 3


I've used ssh-copy-id without problems. Try this

ssh-copy-id pi@<your raspberrypi IP>

Then provide your actual password, and next time you will be able to login without password.

  • I was manually putting my public key in authorized_keys2. When I ran this, it put it in my authorized_keys file. It seems that for what ever reason raspbmc doesn't use authorized_keys2. Perhaps someone with more authority on the subject might be able to explain why. Commented Jan 22, 2013 at 20:16
  • 1
    So according this: itefix.no/i2/content/authorizedkeys-vs-authorizedkeys2 newer versions of ssh just use authorized_keys and don't distinguish between authorized_keys and authorized_keys2. I guess raspbmc uses said newer version of ssh? Commented Jan 22, 2013 at 20:28
  • 1
    Raspbmc use dropbear as ssh server and client, and it is version 2 only [matt.ucc.asn.au/dropbear/dropbear.html].
    – Pipe
    Commented Jan 24, 2013 at 8:36
  • Well then it all makes sense. Thanks for clearing it up :) Commented Jan 24, 2013 at 23:56

There is some general troubleshooting you can do:

Local machine:

  • Make sure permissions on the .ssh folder is 0700. chmod 0700 ~/.ssh
  • Make sure permissions on the private key are 0600. chmod 0600 ~/.ssh/id_rsa (or whatever your private key filename is)
  • Make sure permissions on the public key is 0644. chmod 0644 ~/.ssh/id_rsa.pub (or whatever your public key filename is)
  • have you included the (private) key in your ssh-agent? ssh-add -l should show it.
  • Is it using the key? connect with ssh -v user@host to look for key usage, like this: debug1: Authentication succeeded (publickey).

Note you can connect without adding the key to your agent: ssh -v -i ~/.ssh/id_rsa user@host

On the RaspberryPI:

  • Make sure permissions on the home folder is 0750 or 0755. chmod 0750 ~
  • Make sure permissions on the .ssh folder is 0700. chmod 0700 ~/.ssh
  • Make sure the permissions on authorized_keys is 0644. chmod 0644 ~/.ssh/authorized_keys.
  • That's a great answer. There's another reason why private key authentication may not work: permissions on the user's home directory. If you check /var/log/auth.log you might find Authentication refused: bad ownership or modes for directory /home/user_name. Doing chmod 750 /home/user_name fixes it. Commented Feb 21, 2014 at 21:52

The accepted answer is missing the -i in the ssh-copy-id command.

Here is the procedure in its simplest form:

First, generate a public key that can be shared with the other computer.


Just press enter to the three questions.

Then, append your public key to the other server like so:

ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host

where remote-host can be either the name from your /etc/hosts file or the IP address.

It will prompt you to accept the other host's key - you answer yes (not just y) Then it will prompt you for the other server's password.

That's it. Your key has now been appended to the remote-host's .ssh/authorized_key file.

To use it, just run scp or ssh as normal and you will see that it no longer prompts you for the paswsword of remote-host.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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