I’ve added the pub key to the security setting in the droplet but whenever I try to ssh to my vm I get firstname.lastname@example.org : Permission denied (publickey).
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!
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.
Click below to sign up and get $200 of credit to try our products over 60 days!
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
Your previous ssh-key pair is no longer present on your personal machine and you’ll need to generate a new pair and then upload it to your droplet to fix the problem.
You can check our article on How to Set Up SSH Keys on Ubuntu 22.04 and How to Upload an SSH Public Key to an Existing Droplet
You can access the droplet from the DigitalOcean console and then temporary enable the PasswordAuthentication on your droplet and access the droplet with a password to upload the ssh-key.
If you haven’t created new pair of keys you’ll need to do that first.
You can enable PasswordAuthentication for your Droplet by modifying your
/etc/ssh/sshd_configfile. Once set to Yes restart the SSH service and connect via an SSH client for a more stable connection. You can then modify your
~/.ssh/authorized_keysfile to add the appropriate public key.
You can then upload the key using this command:
Hope that this helps! Regards