Infrastructure at your Service

Elisa Usai

Convert private key generated via OCI Console to ppk

I am pretty new on the Oracle Cloud Infrastructure technology, so maybe I am talking about something you already know. But anyway I prefer to share this case: it can help if you encounter the same problem as me. Let’s take the risk to have too much information rather than nothing! 😉

The problem

I was doing some tests on the new MySQL Database Service and during the setup I decided to generate my ssh keys via the OCI console:

When I tried to connect via PuTTY or MobaXterm to my compute instance using the opc account and my private key (generated previously), I got the following error:

Looking at the keys generated via the Oracle Cloud console, I saw that they were defined in the following format:

The solution

Actually I don’t work directly on a Linux system. So I need to convert my private key if I want to make it usable via my connection tools.
First step is to transform it to RSA format. I can do it using OpenSSL:

# openssl rsa -in ssh-key-2020-11-24.key -out ssh-key-2020-11-24.rsa

Second and last step is to convert it to ppk format. I can do it using PuTTYgen.
I load the private key:

I filter on all files types:

I select my RSA key and I click on Open:

I click on Ok on the following message:

and then on Save private key:

So I save the key with a ppk format:

Tests

I can now use my private key to connect to my OCI compute instance via PuTTY:

or MobaXterm:

Hope this can help you!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Elisa Usai
Elisa Usai

Delivery Manager & Consultant