How to add an SSH key to an existing Linode?

We lost access to the machine where we originally created one of our Linodes and added an SSH key during the creation. I'm not able to find a way to add a newly generated SSH key to the Linode and instead am having to enter the password on every login.

5 Replies

You can create a directory called .ssh in your login's account home directory. Then make a file called authorized_keys using vim, nano, or whatever text editor you use in that directory. Copy and paste your public key in that file if you still have it on hand.

If not, generate a new key file and save your public key in that directory. If you need more information checkout:

Alternatively, I create a directory called $HOME/.ssh/public_keys. I put all the public keys for all the systems I want to have access to the Linode there.

I create $HOME/.ssh/authorized_keys by doing

cat $HOME/.ssh/public_keys/* >$HOME/.ssh/authorized_keys

and adjust the ownership/permissions appropriately. I get all the public key files to the Linode with scp(1) and enter the password appropriately. I log in to the Linode with ssh(1) by typing in the password. These are typically the only times I do this…

You can build $HOME/.ssh on another system if you like. Just make sure the ownership/permissions are correct after the files arrive on your Linode.

-- sw

Thanks, @LouWestin! That worked.

@stevewi, that's a great idea too!

@teamfluxion You're welcome! Also Linode has an option where you can save your Public key(s) on your account so if you make a new server you have the option of adding it to right at creation. It's a really nice feature.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct