Ssh login with key and Dropbear

G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=24
G_DIETPI_VERSION_RC=1
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

Pi3B+

i have on my local desktop

cat ~/.ssh/id_rsa.pub | ssh 
root@192.168.42.1 "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"

but not login with key?
why

how can i fix

thanks
max

What error message do you get, when you try to connect?

No error messages
ssh root@192.168.42.1
root@192.168.42.1’s password:

password works but not automatic with keyfile

I am not expert but just want to share information. dropbear works with dbclient, in my home one machine is ssh with other machine through this command
"dbclient -i /home/homeassistant/.ssh/homeassistant homeassistant@192.168.1.90 'sudo systemctl hibernate'"

&

dropbear make ssh key through this command
//home/homeassistant/.ssh# sudo -u homeassistant dropbearkey -f /home/homeassistant/.ssh/homeassistant -t ecdsa -s 256

tanks mail2rst
but this must work with the openssh client

Using putty is working well with ssh keys and Dropbear. I guess keys are not setup correctly on your end. There are a couple of similar topics on this forum describing the way.

Did you maybe generate a password protected key?

I need an ssh client for the console. It works perfectly for all other connections to my VPS servers

no is the same key to all my VPS-Server

Can you check permissions of ~/.ssh which you created, it has to be 700 or something similar, where only the owner can write. Authorized key folder needs to be readable at least by the owner (eg 400)

yes 700 root:root and local 400

did you verify the content of authorized_keys file? Is it correct? Should be a single line. And the permission of the file itself? Theoretically you could copy the file from a different server and just upload it via SCP. And you are sure on client side you use as well the key while opening the SSH session?

On my system key authentication is running fine

Dec 01 09:42:23 DietPiProd dropbear[3693]: [3693] Dec 01 09:42:23 Pubkey auth succeeded for 'root' with ssh-rsa key SHA256:

In general it works fine for me too.

root@magiatiko:[~]$ cat .ssh/authorized_keys 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6c/QrHmtG6XFwZTJVaYYNT5DbKTlC3yL3ZcCvO0nXy7Jwck97rm1To2yzpO8q+DOXfPKGoTSy7WW9lQLf4v0fEBO7Wh34T+jkMl04Nn6dyaDs8fxU1wmWuz+wQx5D+0ACAQhTrzR7LSlREPviZu4fbOkaL7TDvFFggbVTZoIeOdd/6qd3s4od0Y4RnI7DHr4foCdByXdOFnxSX4YL2EimWaxKXl2mb6sXxZoyUSbNL7sbLFN6yzcghk+/uXzcIQKrNAFyd3J3yLajMwN9g4TmHDouozX61JABsCp2FGSxK2vrWj7NVZ68by7NtRXqGheIF/E/dzELeEpsblBAHqIhF0ND76J0YzUDEKoIMj4yhr6NxEgfMhxirmUU0PnFmDqtXUMkmM5eBSLhZ6l6aV3cOG2syHR+1NUL+MSVlQZGlDR+dqdd8HqHo4+ZYI/uWuAuDxZia1Tc6jawsoVHtFMBemMMzhWzmbALV5ZuN0l17gupAHIY6hw5liKznUlVAjR5KiQeCqlBVFz+5y64rFSxWz7zrHj2mWvRYFBeohY1wyzU/7Um6cv325oNQvXMmXkexiE+WzOBEMNjjtz7gaBYdzK9SarEmQckf45OuNTyqn5Jmcw7FQw8G8rRpJjmQoMR6Ja7dHzsjfcqWJD0GOo3iwr6Xxw== "trendy"

root@magiatiko:[~]$ ls -lah .ssh/
total 20K
drwxr-xr-x 2 root root 4.0K Sep 20 23:39 .
drwx------ 6 root root 4.0K Nov 28 10:13 ..
-rw-r--r-- 1 root root 5.8K Sep 20 23:39 authorized_keys
-rw-r--r-- 1 root root  104 Aug 27 02:55 known_hosts

If the issue persists, run from client ssh -vvv root@192.168.42.1 and paste here the output.

I copy the key from my VPS-Server then works:-)

thanks

1 Like