Trying to access your DigitalOcean droplet and can't get beyond Permission denied (publickey) ?
This could be due to multiple reasons, having th...
For further actions, you may consider blocking this person and/or reporting abuse
This article was very useful, but to help people coming from Google, this error (Permission denied (publickey)) also happens if your identity is not set correctly.
When you do
ssh_keygen
it will generate a new SSH key, which the default name isid_rsa
. If your computer happens to have another key already, with another name, your identity might be set to that key.You should edit
~/.ssh/config
, and make sureIdentityFile
is set to the correct private keyI lost my access to DigitalOcean,
this tip of yours was my salvation, change the file name to id_rsa
Thanks
I solved using this solutions
Thanks for the quick solution! If your on a mac you wanna make this edit here /private/etc/ssh/ssh_config
i literally created an account just to say thank you.
Like other commenters, I also created an account just to say Thanks. Somehow I lost the ability to remote ssh into my droplet and your post gave me the fix I desperately needed in a clear and concise manner. Thank you again!
Thanks for sharing this.
I usually change this:
I needed one more step.
Once you ssh to your server as a root, I need to copy my root ssh to /home/your-username/.ssh:
Run the following:
Now you can ssh using your name.
amazing! after sifting through 100s of pages talking about either solutions I already know or irrelevant ones, THIS IS THE ONLY THING THAT WORKED FOR ME.
DigitalOcean should include this in their docs. Thanks mate!
Nice, breakdown. Helped 👍
Had an issue with this at step 4, where the console still asked my user account for a password (not the root.) This means when I switched password authentication back to "no" I got the publickey error and was back to step 1. Solved it by:
P.S If you're using a remote machine to access the droplet, make sure to GENERATE THE SSH KEY ON THE REMOTE MACHINE.
Thank you so much for this, helped me out.
Hey Sailesh, I've also just created an account to say thanks!!! You rock!
Thank you Sailesh. This instructions helped me to solve the issue!
Like a lot of people I created an account just to thank you! THANK YOU!
I am getting a permission denied when I try to save the authorized key file in the second to last step. Thoughts?
Thanks a lot. The browser console was turning me nuts.