By sub359
I initially created a droplet and added my SSH key in the creation process. It worked well, I could easily connect to server from my local machine via SSH. However, I recently had to reinstall my OS and lost my saved ssh key, so have had to create a new ssh key. I can’t get it to work. I have tried the commands and get these error messages:
C:\ $ ssh root@droplet IP
root@droplet IP: Permission denied (publickey).
C:\ $ ssh -i ~/.ssh/id_rsa root@droplet IP root@droplet IP: Permission denied (publickey).
Also, I have deleted my original ssh key from my digitalocean droplet account to try and resolve this but that has not helped.
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!
Hi @sub359,
It seems like you are trying to use your private id_rsa key to enter. In order to enter using your SSH key, you’ll need to do the following.
Copy your public ssh key in the file id_rsa.pub.
SSH into your droplet’s console and your root password from your Contron Panel
Paste the id_rsa.pub contents in your ~/.ssh/authorozied_keys
Restart your sshd service service sshd restart
Give it another go to SSH to your droplet.
Regards, KDSys
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.