Why I cannot log in with publickey as a user (Ubuntu 22.04)


I am using the lastest version of Ubuntu and I added SSH Key via Digital Ocean when I created the Droplet.

Here is my sshd_config (I pointed with arrows what I changed and still does not work):

What should I do?

Thank you!

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
June 17, 2022

Hi there,

What is the exact error that you get when you try to login? Also what SSH client are you using?

Can you try adding the -vv flag to your SSH command, that will show you the reason why the connection is not working.

If you’ve added your SSH key to the Droplet, before creating it, there should be no changes to the SSH config required. If the SSH key was added to your DigitalOcean account after the Droplet creation, you would need to add your public SSH key to your Droplet manually:



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up