Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

Troubleshooting • Re: Permission denied (publickey). Regardless of what I do

$
0
0
I checked in my newly installed rpi3b

SSH with root … permission denied always
SSH with my username … works all the time

You can do this: “sudo su - “ after your login
That is likely because you created your ssh key using you username and not root - keys are generally user specific
Keys are not user specific, but the public key needs to be installed in the users home on the Raspberry Pi, i.e. /root/.ssh/authorized_keys.
/root/.ssh and /root/.ssh/authorized_keys must be owned by root.

Login as default user

Code:

sudo cp -aR .ssh /rootsudo chown root:root /root/.sshsudo chown root:root /root/.ssh/authorized_keys
Worked out of the box on my Raspberry Pi OS Bookworm Lite
^This. Also worth mentioning for completeness that in addition to the owner (root:root in this case) and protection (600) being correct, the authorized_keys file must contain the public key for the private key you're using on the client system.

Statistics: Posted by bls — Mon Jul 14, 2025 5:10 pm



Viewing all articles
Browse latest Browse all 8037

Trending Articles