I have the droplet on the digital ocean. I have tried to add ssh key to existing droplet. But there they asked for root password and I don't have root password. I have tried to connect to the droplet through the putty
. It is giving message : Unable to use key "home/id_rsa" (OpenSSH SSH-2 private key)
. How to connect to droplet using ssh key? And What is the proper way to connect to the droplet? Is there any way to add ssh key to the existing droplet?
Use OpenSSH to create new SSH keys on MacOS, Linux, or Windows Subsystem for Linux. Use PuTTY to create SSH keys on Windows systems without Bash. Add your SSH key to your Droplets. On DigitalOcean, you can upload your SSH public key to your account, which lets you add it to your Droplets at creation time.
I registered few of the SSH keys for different PCs, so my method is that
1.) Use another pc to login eg.bash (ssh root@yourDropletIP)
2.) Go to your .ssh folder (/.ssh)
3.) Use nano or other text editor to open (nano .ssh/authorized_keys)
4.) Added your new machine ssh-keys to end of the file (notice: check is any empty space between keys, if so, delete it.
5.) Use your new machine to log in and enjoy!!!
I have to hack around this process.
pbcopy < ~/.ssh/id_rsa.pub
cat keys.txt > authorized_keys
You can reset root password at digital ocean's website.
This function appear at your droplet's "Access" tab.
And you can follow this article to get access to your droplet using ssh-key
https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-putty-on-digitalocean-droplets-windows-users
This may be useful for anyone else who is using Windows with PuTTY.
Change the sshd_config file - set the PasswordAuthentication entry to yes, restart sshd, then login to the droplet via PuTTY.
Copy your public ssh key to the clipboard in Windows. In the PuTTY console, paste the key into the authorized_keys file with a text editor (nano).
Go back into the sshd_config and set PasswordAuthentication back to no.
Restart sshd, logout. Login via PuTTY without a password.
References:
https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-putty-on-digitalocean-droplets-windows-users
https://www.digitalocean.com/community/tutorials/how-to-create-ssh-keys-with-putty-to-connect-to-a-vps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With