$ sudo vi /etc/ssh/sshd_config
ChallengeResponseAuthentication no
PasswordAuthentication no
$ sudo vi /etc/ssh/sshd_config
#Disable password for users so they can only connect with keys
# At the end of the file
ChallengeResponseAuthentication no
Match User user1,user2,root
PasswordAuthentication no
Match Group data_user
PasswordAuthentication no
# To check syntax error in the file
$ sshd -t
# Restart the server
$ sudo systemctl restart ssh