I cannot connect to my raspberry pi through ssh anymore...

Everything was working since the beginning: I removed the possibility to connect with a password, and I was connecting to my rpi using ssh and my ssh key for weeks.

But yesterday I installed node.js and I restarted my rpi, and now I am getting a "Permission denied (publickey)" when I try to ssh it.

What should I do to fix this issue? any advice? I can still plug a screen and a keyboard and log into it, and everything I checked (sshd config, ...) didn't changed...

Thank you for your help!

  • Try cleaning up the id_pub* files inside the .ssh directory of your login say for example /home/pi/.ssh . Also clean up entry pertaining to the Raspberry pi ssh in known_hosts file in your system. And try again. If it works then it might be due to the ssh key corruption.
    – Varad A G
    Jun 29, 2016 at 11:31

1 Answer 1


A "Permission denied" error means that the server rejected your connection.

Be aware that there are many other reasons why authentication would fail. SSH is usually pretty explicit about what went wrong if you care to add the -v option to your SSH command and read the output, as explained in many other answers to this question.

Common reasons are

1. Trying to connect with the wrong key. Are you sure this instance is using this keypair?
2. Trying to connect with the wrong username. 
3. Trying to connect the wrong host.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.