This question already has an answer here:
I'm setting up a raspberry pi 3 running the raspbian operating system, that will be connected to wifi constantly with ssh enabled, thus security is a must. I have successfully enabled login via a public-private key pair, and am trying to make this the ONLY way to access the pi via ssh.
I've looked at a few threads on this topic, and scoured my sshd_config file for anything that smacks of a password login (PasswordAuthentication, PermitRootLogin, KerberosAuthentication, UsePAM, etc.) to turn them all off, but to no avail. As soon as a login with the public key fails, it immediately prompts for the password.
I've restarted sshd and even rebooted the pi several times, but nothing changes.
I'm not too desperate since the password is quite strong, but it seems like such a waste to use a public key login if password logins are possible.