By SeeYouSpace
I’ve created my droplet and I can’t add a public SSH Key to my droplet. I’ve read How To Set Up SSH Keys, but it seems like it’s only for Mac users. I can’t seem to find a Windows putty.exe version of the article. Thank You.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
The command:
ssh-keygen -t rsa
is not specific to OSX and should execute from the CLI once you’ve logged in as root.
Ideally you should generate a stronger key than the default bit strength (which is 1024 bits or 2048 bits depending on OS and SSH version). To do this, we’d update the command above to:
ssh-keygen -b 4096 -t rsa
or
ssh-keygen -b 8192 -t rsa
The -b argument specifies the bit strength of the key.
You can also run:
ssh-keygen --help
for quick-reference to what the argument options are and what they do.
–
If the ssh-keygen command is ran as root, and you do not specify where the key is to be stored when prompted, the default directory is going be:
/root/.ssh/
Inside this directory, you’re also going to find a file named authorized_keys. If you didn’t setup an SSH key with your Droplet from DigitalOcean’s CP, this will most likely be empty. This file does not automatically update when you generate a new key, so you’ll have to use cat to add the public key to the file.
To do this, we’d use the following command:
cat /root/.ssh/your_public_key >> /root/.ssh/authorized_keys
It’s important to note, that is two (2) > – Using two > means append to the end of the file while using a single > would mean replace all contents with the contents of what we’re pushing in.
–
With that said, PuTTy uses it’s own format, PPK, when logging in to SSH from putty.exe, so you’ll need to copy the private key that was generated to a text file, import it using puttygen.exe (link) and convert it to a PPK file, which you will then define under:
Connection -> SSH -> Auth -> Private key file for authentication
You can also use PuTTyGen.exe to create a key-pair, though I find that it’s much faster from the CLI as you’re not forced to move your mouse around to generate randomness (as you are with PuTTyGen).
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.