cat ~/.ssh/id_rsa.pub | ssh firstname.lastname@example.org "cat >> ~/.ssh/authorized_keys"
Here's the tutorial:
Also I cannot se any droplet resize option available, any ideas why is that?It could be that the physical server that your droplet is on does not have enough available space to resize your droplet -- can you post a screenshot of the resize page?
I didn't see this in the answers below.
But if you already have a public key that you want to reuse, you can just add it to ~/.ssh/authorized_keys file.
For anyone finding this via Google that found this answer: logging into your droplets via SSH on a Windows machine where you might be using a specialized client to generate your keys, the command asb uses in this comment thread doesn't work, and there really aren't any answers to tell you why.
Here's an explanation. For a quick command-line copy and paste answer, scroll to the bottom of this comment. Breaking down the command:
On a *NIX machine, this would output your local public SSH key.
The pipe character is standard Shell-speak for "piping" data into the stdin (input console) of a program or file handle. An easy way to remember it is the output of the command on the left will be received as input for the command on the right.
ssh email@example.com "cat >> ~/.ssh/authorized_keys"
This is standard use of the SSH command, except the part in quotes actually encloses a command to send to the server you're SSHing into.
What this adds up to mean is "output my local public key into the authorized_keys file on the server I'm SSHing into". Which, on Windows, unless you use a platform like Cygwin for all of your SSH, means it wouldn't work, because Windows isn't a *NIX-style platform.
Solution for Windows users using native SSH clients: Paste the following into a root shell on your droplet:
echo "YOUR_SSH_PUBKEY_GOES_HERE" >> ~/.ssh/authorized_keys
Your SSH key should now be authorized on the droplet.
Here is the working guide on how to add a SSH key to existing droplet (for Windows users)
I am attempting to follow
How about when you already have an SSH key used with other droplets but start a new droplet without using it; how do you later implement SSH logins using that key?
This snippet/command from https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets did not work
"In order to add additional keys to pre-existing droplets, you can paste in the keys using SSH:
cat ~/.ssh/idrsa.pub | ssh root@[your.ip.address.here] "cat >> ~/.ssh/authorizedkeys" "