SSH w 2FA Doesn't Work

I can login SSH (non-root) if 2FA for SSH is NOT set. But, as soon as I ENABLE 2FA for SSH, I’m unable to open an SSH session. I get the PW prompt, enter it CORRECTLY, and am prompted for the 2FA code. I enter than, and am just returned to the PW prompt. Console reports:

Aug 6 11:23:56 truenas.local 1 2025-08-06T11:23:56.304886-04:00 truenas.local sshd 13084 - - error: PAM: Authentication error for UserXXX from 192.168.1.xxx

Disabling SSH 2FA then allows me to connect SSH normally. YES, I’m using 2FA successfully to login as ROOT from the Web GUI.

What am I missing here?

Could you add some details about the version you are running?

Sorry, Wan’t thinking clearly.

TrueNAS Core TrueNAS-13.0-U6.7

I presume you checked the box ‘Enable Two-Factor Auth for SSH’?

On a separate note have you considered using key authentication?

Johnny,

Thanks. Yes, the box was CHECKED. UNchecking it was required for SSH connection. What’s strange is that w it CHECKED, attempted connection took me to the prompt for the 2FA code. But entering that code just returned me to the PW prompt.

No, I havent even considered Key authentication. And, yes. My clocks are in-sync.