Question

Yet another "Permission denied (publickey)" issue

Posted September 10, 2020 112 views
Ubuntu 20.04

Hi all,

I am trying to SSH from OSX to my Ubuntu droplet.I have checked to make sure my public SSH keys match up and I have already gone through the process of a full reinstall. I’ve also applied

chmod -R go= ~/.ssh
chown -R $USER:$USER ~/.ssh

logged out and then back in. Nothing works. I’m thankful the browser CLI is available but, I need to use a local terminal. Any advice welcome.

Many thanks. Aaron.

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
4 answers

So just to recap …

You have your public SSH key on the Ubuntu droplet inside the appropriate ~/.ssh/authorized_keys file
You have the private SSH key on your local OSX in the ~/.ssh/ directory with correct permissions

If that’s the case, have you also modified your ~/.ssh/config to use this key when connecting to the host?

If you haven’t done that config step, are you specifying the SSH key to use when connecting, for example:

ssh -i ~/.ssh/your-private-key-file root@IPADDRESS

I hope this helps but more info could be helpful if you’re still having trouble - here’s a tutorial on it as well:

How To Use SSH Keys with DigitalOcean Droplets

Hello, @AaronDay

If you have multiple SSH keys, you may need to specify the path of your private key using the -i flag, as in

ssh -i /path/to/private/key username@203.0.113.0

Make sure to substitute the path to your private key.

As @baraboom already mentioned you can double check our existing tutorial on how to use ssh keys with DO droplets:

https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/

and https://www.digitalocean.com/docs/droplets/how-to/connect-with-ssh/openssh/

Hope that this helps!
Regards,
Alex

Hi, @aalborz2020

Do you have multiple SSH keys on your machine? If that is the case have you tried to specify the exact key to connect to your DO droplet.

If you have multiple SSH keys, you may need to specify the path of your private key using the -i flag, as in

ssh -i /path/to/private/key username@203.0.113.0

Make sure to substitute the path to your private key.

As @baraboom already mentioned you can double check our existing tutorial on how to use ssh keys with DO droplets:

https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/

and https://www.digitalocean.com/docs/droplets/how-to/connect-with-ssh/openssh/

Hope that this helps!
Regards,
Alex

Show answer This answer has been marked as resolved by AaronDay.
Submit an Answer