I use Raspberry Pi Imager to create an SD card with Raspberry Pi OS Lite (64-Bit) for my Raspberry Pi 3B. I activate SSH and choose authentication via public key. Until recently this worked fine but now I can't access my Raspberry Pi anymore after setting it up.
I removed all keys but id_rsa
and id_rsa.pub
from ~/.ssh
and flashed a new card. When trying to connect, this is what I got:
$ ssh [email protected]
The authenticity of host 'raspberrypi.local (2a01:c23:79cb:600:3e35:ed6b:e928:c9fc)' can't be established.
ED25519 key fingerprint is SHA256:Rmv+CEpgAS6meAB/9iR2rPX+Yu+VQNUGAXMbLWyQRZo.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'raspberrypi.local' (ED25519) to the list of known hosts.
[email protected]: Permission denied (publickey).
I'm especially irritated by the ED25519 reference. I created simple RSA keys with ssh-keygen
(the ones you get if you just repeatedly hit enter).
I depend on regularly reflashing my SD cards without having to manually set up SSH all the time. How can I get SSH access working out of the box again when flashing with Raspberry Pi Imager?
~/.ssh/known_hosts
file has permissions-rw-------
or authentication will fail due to permissions. From what you describe, it sounds like a permissions problem somewhere. Additionally, the Public-Key from the host you are trying to connect FROM must be in yourauthorized_keys
file.