SSH key authentication - Printable Version

+- Forum (
+-- Forum: Software (/forum-6.html)
+--- Forum: Configuration (/forum-17.html)
+--- Thread: SSH key authentication (/thread-3043.html)

SSH key authentication - Skywatch - 18th Jun, 2015 06:51 AM


I have been following the guide here .... ... to add keys to fresh image of xbain pi.

It used to work before, but now I have a problem in that whatever I do I get the 'server refused our key' message.

I made sure to remove the unwanted items so the key begins with just ssh-rsa AAA etc. and made sure to remove any breaks or returns so it is all on one line.

Has the move to inet.d made a difference in the procedure?

I'll keep on searching, but no good ideas so far.


RE: SSH key authentication - CurlyMo - 18th Jun, 2015 07:14 AM

In a normal setup it's pretty easy.

XBian 1
~# ssh-keygen -f /root/.ssh/id_xbian -N ""
~# cat /root/.ssh/
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyv3fYKrokrVm8PTqtwLuJjUarvJlCbnbR8HAwUlaVLo3vz+I6​WnB+vXemJ6gcCL8Re0Y1RDN1ThikPJ+rBG7lc8cca5bMbcQ98J6EVPljd/aoabkMntKcTYBwfEXNQljOpxb94Kp4/9OEPo8Sg68p+m2evfZmaa6UhA/DzIKWSI3ZBbQpH+XV+sZd1c7fsdp4/OLCKrXwrWd9xlcKvx60hI6Eg8f9Z/vd3sINsrgN83Lq/PynTWVcciUSSbBOB8nYLCMR2apMLDpiqBmLxNO5mI0VEdht/sfEjZxDZi/ldTaMnVNLqs0Qk58XJlDcRzL2oHtCVX9UHsKVxNz9KFwp

XBian 2
~# echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyv3fYKrokrVm8PTqtwLuJjUarvJlCbnbR8HAwUlaVLo3vz+I6​WnB+vXemJ6gcCL8Re0Y1RDN1ThikPJ+rBG7lc8cca5bMbcQ98J6EVPljd/aoabkMntKcTYBwfEXNQljOpxb94Kp4/9OEPo8Sg68p+m2evfZmaa6UhA/DzIKWSI3ZBbQpH+XV+sZd1c7fsdp4/OLCKrXwrWd9xlcKvx60hI6Eg8f9Z/vd3sINsrgN83Lq/PynTWVcciUSSbBOB8nYLCMR2apMLDpiqBmLxNO5mI0VEdht/sfEjZxDZi/ldTaMnVNLqs0Qk58XJlDcRzL2oHtCVX9UHsKVxNz9KFwp" > /root/.ssh/authorized_keys
~# chmod 600 /root/.ssh/authorized_keys

XBian 1 (
~# ssh -i /root/.ssh/id_xbian

That should be it.

Do notice that these steps are made for direct root login over ssh. If you want to use the xbian user, change the XBian 2 key path to /home/xbian/.ssh/authorized_keys. If you login with XBian 1 with ssh xbian@ -i /root/.ssh/id_xbian

RE: SSH key authentication - Skywatch - 18th Jun, 2015 06:16 PM


Thanks for taking the time to explain that.

I generated the keys using puttygen on a laptop and then copied and pasted them into xbian under the path /home/xbian/.ssh/authorized_keys , then did the chmod and edited the keys as stated, so that should have worked.
So far the 2 pi's look like the installations are identical. Only difference is that pi1 is using an RC release with xbmc and pi2 is using xbian1.0.
Both pi's are to be accessed by a Win7 laptop using putty (again as far as I can tell the presets in putty have the correct paths for the keys).
I'll spend some more time today

Just one question though, as /etc/services is now where the SSH port is changed is sshd_conf still used for keys and settings etc?



RE: SSH key authentication - CurlyMo - 18th Jun, 2015 06:31 PM

I didn't have to change the SSH configuration. And please use the ssh-keygen. Then i know for sure you did the same thing.

RE: SSH key authentication - Skywatch - 18th Jun, 2015 07:42 PM

HI CurlyMo,

I finally got the problem.

Seems that authorized_keys was owned by root. Chaning that ownership to 'xbian' and it works now!
I don't recall having to do this previously, but hey, if it works, it works!
Thanks for kind assistance with this.