Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

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?

share|improve this question
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 Jan 22 '13 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 Jan 22 '13 at 10:14

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
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. –  Kurtis Nusbaum Jan 22 '13 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? –  Kurtis Nusbaum Jan 22 '13 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 Jan 24 '13 at 8:36
    
Well then it all makes sense. Thanks for clearing it up :) –  Kurtis Nusbaum Jan 24 '13 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 .ssh folder is 0700. chmod 0700 ~/.ssh
  • Make sure the permissions on authorized_keys is 0644. chmod 0644 ~/.ssh/authorized_keys.
share|improve this answer
    
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. –  Ivan Koblik Feb 21 at 21:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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