Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openWRT Dropbear SSH key authentication fails with "unknown algo"

Good day, I'm trying to figure out how to get a user to ssh into openWRT with only a key. I followed these instructions: https://wiki.openwrt.org/oldwiki/dropbearpublickeyauthenticationhowto.

In short: On a Linux box: If you haven't already got a

.ssh/id_dsa.pub
ssh-keygen -t dsa
scp ~/.ssh/id_dsa.pub [email protected]:/tmp

On openWRT:

cd /etc/dropbear
cat /tmp/id_*.pub >> authorized_keys
chmod 0600 authorized_keys

When I try and ssh in, I get this error:

authpriv.warn dropbear[2085]: Pubkey auth attempt with unknown algo for 'MyUser' from 1.2.3.4:11111

I have tried generating a RSA key too, same result. I can log in as the user using a password:

authpriv.notice dropbear[2089]: Password auth succeeded for 'MyUser' from 1.2.3.4:11111

like image 818
Vissie Avatar asked Sep 16 '25 04:09

Vissie


2 Answers

Maybe it's the problem of the OpenWRT version. Try ${HOME}/.ssh/authorized_keys instead.

like image 57
Yangtuo250 Avatar answered Sep 18 '25 19:09

Yangtuo250


Using libreCMC v1.5.15 (and earlier versions), which is based on OpenWRT, I noticed the following dropbear error in the system log:

Sat Jun  8 21:21:26 2024 authpriv.info dropbear[22699]: /etc/dropbear/authorized_keys must be owned by user or root, and not writable by others

So I temporarily enabled password authentication for the SSH service (dropbear), and ran:

chown root:root /etc/dropbear/authorized_keys

This appears to have resolved the problem for me; publickey authentication now succeeds and I've removed password authentication.

like image 40
Apteryx Avatar answered Sep 18 '25 17:09

Apteryx