To improve security you should only allow ssh pass-wordless (key based) authentication, especially for root:
Lockdown Root SSH Access to Keys Only
After you have confirmed that you can now login as root to the server without being prompted for a password you can disable password logins for root. This makes your server more secure since no one can brute force your SSH password - digitalocean.com ![]()
It's necessary to edit the server's SSHd configuration:
nano -w /etc/ssh/sshd_config
and update the following line to now read:
PermitRootLogin without-password
If you want to have these changes take effect you will need to Restart the sshd daemon. First you may wish to also lockdown password access for other users (you can restart the ssh daemon at the end).
Lockdown Password Access for other users
Once you have SSH Keys configured, you can add some extra security to your server by disabling password authentication for SSH. (Note that if you do lose your private key, this will make the server inaccessible.
To disable this setting, you can do the following:
nano -w /etc/ssh/sshd_config
In this file, set the following settings to the following values. If these settings are already in the file, set them to "no" rather than add new lines.
ChallengeResponseAuthentication no PasswordAuthentication no UsePAM no
Once this is done, restart the SSH daemon to apply the settings.
Now it's necessary to restart or rehup the sshd process to have it re-read the new configuration. On some systems you can use the following scipt to restart the ssh daemon: