Check /etc/ssh/sshd_config
file.
sudo nano /etc/ssh/sshd_config
- Make sure
AllowUsers USERNAME
is available for your username. - If you login as root, make sure
PermitRootLogin yes
. - If you login with password, makr sure
PasswordAuthentication yes
. - If you just edited
/etc/ssh/sshd_config
, runsudo systemctl reload sshd
for the changes to take effect.
Make sure the user have public key configured
- Make sure
~/.ssh/authorized_keys
exist. - If the file doesn't exist, refer Copy Ssh Public Key.
- If root have the public key, switch to root user and run
sudo rsync --archive --chown=USERNAME:USERNAME ~/.ssh /home/USERNAME
to copy root public key to USERNAME.