Just a note before you do this you should have a sure, guaranteed way into the system such as local, KVM or preferably publickey making bruteforce SSH absolutely impossible since there is no password to bruteforce and even if someone knew the password they wouldn't be able to login except from the local console (presumably you should make sure no one unauthorized has physical access).
1. Edit /etc/ssh/sshd_config
Find the section like this:
2. Uncomment it like so:
3. Restart SSH
After this you won't be able to login with password.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).