I want to use remote explorer in VS Code on Windows to access a server from Ubuntu. Entering a password all the time is annoying, so I tried generating an ssh key using ssh-keygen. The key works fine for a normal user, but I can't login as root.
The error from cmd (ssh root@<server_ip>):
root@<server_ip>: Permission denied (publickey,password). The error in /var/log/auth.log :
sshd[1012327]: Connection reset by authenticating user root <client_ip> port 59021 [preauth] All of the solutions I've seen mentioned sshd_config, but root login is enabled in it. sshd_config:
# Authentication: #LoginGraceTime 2m PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 PubkeyAuthentication yes # Expect .ssh/authorized_keys2 to be disregarded by default in future. #AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 #AuthorizedPrincipalsFile none #AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody I have added the public key to the /home/user/.ssh/authorized_keys file. It seems to me that this key is only for the user, but from the guides it seems that I can use it for root as well.
So why can't I connect as root?