I can’t add ssh key, I used ssh-keygen, but digitalocean says key invalid type

I ran ssh-keygen on my local machine from windows 10.

C:\Users\Dell>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Dell/.ssh/idrsa): idrsaabc
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id
rsaabc.
Your public key has been saved in id
rsa_abc.pub.
The key fingerprint is:
SHA256:iI0B.....2ga0 dell@DESKTOP-4VC
The key’s randomart image is:
+—[RSA 2048]—-+
....
|OOB*o.. |
+—-[SHA256]—–+

C:\Users\Dell>

C:\Users\Dell.ssh>type idrsaabc
—–BEGIN RSA PRIVATE KEY—–
MIIEo........G3rPto0
....
5ItfAoGBAJMSZ0A5tva9ptA8jZKLMQ2sSpYF3szZ7Yag/VHnVHi3muNxtec6e/my
bkZvjbWMFsMV/O9lP……eddn0j
—–END RSA PRIVATE KEY—–

I tried copy/pasting it, with and without those —-BEGIN/END lines.

And it doesn’t work

It says “Key invalid type, we support ‘ssh-rsa’, 'ssh-dss’, 'ecdsa-sha2-nistp256’, 'ecdsa-sha2-nistp384’, 'ecdsa-sha2-nistp521’, or 'ssh-ed25519’.”

I suppose in theory I could create a good password and set up a key myself more manually, but what’s going wrong?

I wonder if maybe i’m doing things a wrong way around e.g. maybe you’re meant to create the key on the remote machine.. But I think i’m doing it the right way around.. using keys created on the local machine and trying to add them to the remote machine.. I think I have that right. But the digitalocean interface isn’t letting me add them.

(not sure what tag to use as I couldn’t see one for ssh)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello @userdo

You need to copy the content of the public key - id_rsa.pub

You can open the file locally on your PC and copy the content of the file and after that connect to your droplet via ssh and add the file to your droplet’s ~/.ssh/authorized_keys file.

You can also check the following tutorial on how to add your ssh-key to an existing droplet:

https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/to-existing-droplet/

Regards,
Alex