Fixing ssh: Exited: String too long on OpenWRT

Sa 12 Dezember 2015
By Uli Köhler

In Linux

Problem

When trying to execute SSH on OpenWRT with a private key, e.g.

ssh -i id_rsa user@host

you encounter this error:

ssh: Exited: String too long

Solution

This error occurs because the ssh executable on OpenWRT is not the same SSH as you would expet on a normal computer:

root@OpenWRT:~# ssh
Dropbear client v2011.54

The 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:

dropbearkey -f id_rsa -t rsa -b 2048

In order to convert existing keys to the DropBear format, try using dropbearconvert

You can extract the public key from the DropBear key like this:

dropbearkey -y -f id_rsa