Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

CrastyCrap's avatar

Permission denied (publickey).

I have droplet on digital ocean for a year now and I access it by using my ssh key and everything was normal until yesterday when i tried to access it I got the following error

[email protected]: Permission denied (publickey).

I tried to create new SSH key and add it by recovery console but it doesn't work I tired to make my droplet key work on password instead SSH key by using that article" https://docs.digitalocean.com/support/i-lost-the-ssh-key-for-my-droplet/" but after restart server i still get same error

anyone can help plz ?

0 likes
3 replies
Tray2's avatar

You should create a new ssh key for the server, there is probably some kind of corruption on the one you got, or maybe some certificate has expired. However you really should not log in as root, that is a very bad practice. You should create a user with sudo rights instead. It could even be that they have disabled remote root logins, that is what I would do before putting my server online.

1 like
CrastyCrap's avatar

@Tray2 i created one but i cant access to server to add it except with recovery console and when i copy and paste it and review the key i found it wrong idk why

djurovicigoor's avatar

Check ~/.ssh/ permissions:

chmod 700 ~/.ssh/ chmod 600 ~/.ssh/authorized_keys

Please or to participate in this conversation.