By default
PasswordAuthentication is set to yes, so explicitly commenting it in /etc/ssh/sshd_config and restart sshd has no effect.You’ll need to explicitly set PasswordAuthentication no to allow only Public Key Authentication.
service ssh restart
https://askubuntu.com/questions/346857/how-do-i-force-ssh-to-only-allow-users-with-a-key-to-log-in