This question already has an answer here:

I am quite new to server administration and I am not doing it very often. Today I wanted to secure my server, especially the ssh server. Is it possible to configure ssh so that only users can login if an public exists in the autorized_keys file? In other words: Disable login with password, only allow login if the public key exists. I searched the web for quite a while but could not find anything pointing me the direction.

Thanks in Ahead.

marked as duplicate by Jenny D, HBruijn Jan 26 '16 at 6:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.