SSH — allow login with public key only / disable login with password [duplicate]

Solution 1:

In order to disable authentication using password, you have to disable the following settings in the configuration file of your sshd server (generally /etc/ssh/sshd_config):

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

Then reload the configuration:

$ sudo service ssh reload