RUT 95x howto outgoing ssh connection

When I try to initiate an ssh connection from the rut device to one of our server I get:

root@RUT/etc# ssh -i /etc/id-oci1.pub ubuntu@130.162.**.
ssh: Exited: String too long

reading :
SSH RSA key authentication (Linux) - Teltonika Networks Wiki (teltonika-networks.com)

describes only incoming ssh connection (rut acts as ssh server)

root@RUT~# ssh-keygen
-ash: ssh-keygen: not found

root@RUT/etc# ssh -i /etc/id-oci1.pub ubuntu@130.162.**.
ssh: Exited: String too long
root@RUT:/etc# ssh -V
Dropbear v2020.81
root@RUT:/etc# openssl version
OpenSSL 1.1.1t 7 Feb 2023

Seems that there is someting wrong with the public key or with ssh implementation.

id-oci1.pub is the pubilc key from target system as RSA 1024 but it does not work with an ecdsa key too.

root@RUT:/etc# ssh -i id-ecdsa-oci1.pub ubuntu@130.162.**.
ssh: Exited: String too long

similar to community post #639

What am I doing wrong ? How can I initiate an outgoing ssh connection ?

The problem you are experiencing is the problem I had. The flavour of SSH used on the RUT devices is a minimalist version by dropbear and as such it doesn’t understand rsa keys. What you need to do is to convert your keys to dropbear keys.

This article was most helpful to me Daniel Michaels | Dropbear and AWS

Hello,

Generate your key using ssh-keygen. On the router, you can do ‘opkg install openssh-keygen’.

Convert your key to dropbear:

dropbearkey -f yourkey_rsa -t rsa

Get a public key from your key:

dropbearkey -y -f yourkey | grep "^ssh-rsa " > your_public_key.pub

Then transfer your key to your other machine.

If it would be a Teltonika router, then on that router:

# if not created
touch /root/.ssh/authorized_keys
cat /etc/yourkey.pub >> /root/.ssh/authorized_keys
cp /root/.ssh/authorized_keys /etc/dropbear
chmod 700 /etc/dropbear/
chmod 600 /etc/dropbear/authorized_keys

On your first router, use dropbear keys:

ssh -i yourkey_rsa root@1.1.1.1

Kind Regards,

Thank you for this clarification, Works with dropbearkey without installing openssh-keygen !

1 Like

This topic was automatically closed after 15 days. New replies are no longer allowed.