I can't SSH to non-root
I disabled both in sshd config and restarted sshd (systemctl restart sshd):
PermitRootLogin
PasswordAuthentication
I am getting permission denied when attemping ssh from my local laptop. I am behind a VPN (installed on router).
Trying to ssh in as 'admin' (a non-root) super-user.
1 Reply
It looks like you accidentally left your PubkeyAuthentication setting commented out. Based on my testing this actually shouldn't matter, but for troubleshooting purposes we'll want to make sure this is changed. Here's the specific line:
PubkeyAuthentication yes
And this will fix it:
sudo sed -i '/^#PubkeyAuthentication/s/#PubkeyAuthentication/PubkeyAuthentication/' /etc/ssh/sshd_config
sudo systemctl restart sshd
After that, let's ensure your permissions are correct. This is the second most common reason for public key issues that I see and it's a very easy step to miss. Let's make sure both ~/.ssh and authorized_keys is correct:
As "admin":
sudo chmod 700 -R ~/.ssh && chmod 600 ~/.ssh/authorized_keys
After that, try again and let us know what happens. If you continue to have issues then you may want to use cat to compare the authorized_keys file with the .pub file on your local computer. While unlikely, it's possible the scp didn't work as expected.