I'm using Debian bullseye. I'm trying to set up SSH two types logins:
- password + code from Google's Authenticator (if user set it, "nullok" option),
- public key + code from Google's Authenticator (if user set it, "nullok" option).
Type #1 works for me. In type #2 I have public key + password (not public key passphrase) + code from GA. I added this line to /etc/ssh/sshd_config
AuthenticationMethods publickey,keyboard-interactive keyboard-interactive
I'd like to user won't be prompted for password if key was supplied. Precisely, how to bypass pam_unix.so demand if public key was provided?
Is there any way to accomplish what I want on one machine? Thanks in advance.
Probably I solved it.
CERN's PAM_2FA project contains minor pam module: pam_ssh_user_auth.so. This module can tell PAM if there was any previously successful sshd authentications like public key (PAM_SUCCESS). So I made following changes in:
/etc/ssh/sshd_config:
/etc/pam.d/sshd:
It allows to skip prompt for password when public key was given.