20 February 2019

Sometimes, by security or usability reasons authentication with SSH keys looks much better than passwords. To generate personal keys, please, do next:

ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]
cat [KEY_FILENAME].pub >> ~/.ssh/authorized_keys
chmod 400 [KEY_FILENAME]
ssh -i [KEY_FILENAME] [USERNAME]@yourhost.com

To disable root login and password based login refer to /etc/ssh/sshd_config and edid next sections:

PasswordAuthentication no
PermitRootLogin no

Then reload ssh server

sudo service ssh restart