How to stop SSH from falling back to password?

Solution 1:

If you don't want to globally disable password authentication on your server you can use the -o "PasswordAuthentication no" option on the ssh command line e.g.

ssh -o "PasswordAuthentication no" YourHost

Solution 2:

You can stop password authentication by configuring the ssh daemon. Edit the /etc/ssh/sshd_config file.

#PasswordAuthentication yes

Uncomment and change the above line to "no".

PasswordAuthentication no

Don't forget to restart your ssh daemon!