Setting Google Authenticator 2FA for SSH on Debian 11

less than 1 minute read

Following my fresh server install, one of my first things to do was setting up SSH access, with Google Authenticator.

It used to work pretty much out of the box, you just modify /etc/pam.d/ssh, make sure you have

ChallengeAuthentication Yes

in your sshd_config and voilà.\

Well, apparently this no longer works out of the box, potentially due to the default value of the AuthenticationMethods value.
In all cases, setting it to

AuthenticationMethods publickey keyboard-interactive

works.