Question

How to I add a second key to the authorized_keys file

Posted August 7, 2017 47.6k views
UbuntuSecurity

I need to add a public key to the .ssh/authorized_keys file on my server, how do I do this as I already see an key in there and I need to add a second one?

Thanks,

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
4 answers

Just add the new key on a new line in the same file.

I can paste anything into that shell. I am unable to ssh in from my terminal. When did this become such hassle?

Thanks. It was that simple.

Hello there,

You can check our article on How to Upload an SSH Public Key to an Existing Droplet

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

I will recommend you to edit the .ssh/authorized_keys via ssh using an ssh-client and not using the DigitalOcean console.

Hope that this helps!
Regards,
Alex