Fixing ssh: Exited: String too long on OpenWRT
Problem
When trying to execute SSH on OpenWRT with a private key, e.g.
example_ssh_cmd.sh
ssh -i id_rsa user@hostyou encounter this error:
error_output.txt
ssh: Exited: String too longSolution
This error occurs because the ssh executable on OpenWRT is not the same SSH as you would expet on a normal computer:
dropbear_version.sh
root@OpenWRT:~# ssh
Dropbear client v2011.54The DropBear SSH variant expects SSH keys in the DropBear format and not in the PEM format (which is generated by ssh-keygen). In order to generate a new key, use dropbearkey like this:
generate_dropbear_key.sh
dropbearkey -f id_rsa -t rsa -b 2048In order to convert existing keys to the DropBear format, try using dropbearconvert
You can extract the public key from the DropBear key like this:
extract_pubkey.sh
dropbearkey -y -f id_rsaIf this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow