How to Passwordless SSH to an OpenWrt Router?

The good ssh-copy-id method which works well on common Linux seems not working for OpenWrt router.

How to Passwordless SSH to an OpenWrt Router?

asked May 27, 2015 by Eric Z Ma (44,280 points)

1 Answer

 
Best answer

OpenWrt's SSH server is Dropbear. It can accept normal RSA keys. But the authorized_keys location is not the same as the openssh "~/.ssh/authorized_keys".

The location for the authorized_keys is

/etc/dropbear/authorized_keys

What you need to do is to put your public key to that file. If you use the default key location ~/.ssh/id_ras.pub, you can do it by this command:

ssh root@YOUR_OPENWRT_ROUTER \
cp /etc/dropbear/authorized_keys /etc/dropbear/authorized_keys.bak

cat ~/.ssh/id_rsa.pub \
| ssh root@YOUR_OPENWRT_ROUTER "cat >> /etc/dropbear/authorized_keys"
answered May 27, 2015 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...