Check /etc/ssh/sshd_config file.
sudo nano /etc/ssh/sshd_config- Make sure
AllowUsers USERNAMEis 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 sshdfor the changes to take effect.
Make sure the user have public key configured
- Make sure
~/.ssh/authorized_keysexist. - 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/USERNAMEto copy root public key to USERNAME.