IainRawlings.com

SSH

Let me start by saying I have a number of Raspberry Pi's of varying models right from the pi 1 to the pi 4. All of these are set up to use SSH private keys to access.

Because these have all been set up over many years and at different points the key situation was a bit of a mess. So today I decided to remedy that.

replacing the keys on the devices to make access simpler for myself I ran into an odd problem due to my use of Pageant for the forwarding agent.

Using Pagent means I have to convert the keys to .ppk files to load them for forwarding.

However when generating a new key, Puttygen would not import the keypair. A quick google suggested that I would need to convert the format of the key to PEM.

I used the following command from the ssh folder on my pi 4:

ssh-keygen -p -f id_rsa -m PEM

This forces the password to be changed (providing you can supply the old one of course!) and changes the format to PEM.

Once I had done this and passed the key to Puttygen, I was able to load and convert to .ppk and add to Pageant.

Just a note, if you've ended up here because you're struggling with SSH keys not validating, you should also check the permissions of the ~/.ssh folder and all files within it such as authorized_keys and the private and publoc keyfiles.

Linux SSH