How to disabled password authentication for specific users in SSHD
Solution 1:
You could set the Parameter PermitEmptyPasswords no
in your sshd
configuration, and delete the passwords for some users, to force ssh key authentication for them.
Solution 2:
Add a Match block to your sshd_config file. Something like this:
Match Group SSH_Key_Only_Users
PasswordAuthentication no
Or if it's truly one user
Match User Bad_User
PasswordAuthentication no
See man sshd_config
for more details on what you can match and what restrictions you can put in it.
Solution 3:
I just learned the hard way that CentOS 5 (with latest updates as of today) does not support the Match command by locking myself out of a remote server. Fun times.
So be warned if you try add the Match command to CE5 and you do service sshd restart it won't and as soon as you close your sshd client you are locked out until you can log back in via console to delete those 2 lines.