Reputation: 159
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?
Upvotes: 6
Views: 15273
Reputation: 121
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!!!
Upvotes: 8
Reputation: 21
One thing I would add is that if you are on Windows 10 (not sure about previous versions), you can go to the MS store, install the Ubuntu shell, and run the "ssh-copy-id" command there. That worked for me.
Upvotes: 0
Reputation: 71
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:
Upvotes: 1
Reputation: 129
I have to hack around this process.
pbcopy < ~/.ssh/id_rsa.pub
cat keys.txt > authorized_keys
Upvotes: 3
Reputation: 1242
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
Upvotes: 1