SSH public key auth fails when UsePAM is set to "no"

Solution 1:

Without PAM (Pluggable Authentication Module) more complicated ssh configuration is required to authenticate. You're looking for this, actually:

# grep Password /etc/ssh/sshd_config 
PermitEmptyPasswords no
PasswordAuthentication no

This will disable passworded login. Ensure you public key settings correctly established.

Solution 2:

Is your user account locked? You can either unlock the user account

passwd -u username

or lock the user account but enable PAM:

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM yes

Tags:

Linux

Ssh