ubuntu – Error: pam_unix(sshd:auth): authentication failure, when try to setup FreeRADIUS and Google Authenticator PAM

I am trying to install FreeRADIUS and Google Authenticator PAM in my ubuntu server and facing the issue at the time of authentication, I know its very common problem but still I didn’t get any solution for this. I will describe the steps that I followed yet.

  1. I follow this link for the installation process:
  2. https://networkjutsu.com/freeradius-google-authenticator/
  3. I configure the freeRadius following the steps of option-1 (Run as Root).
  4. Also configure the freeRadius PAM using option-1
  5. But I am facing problem when try to configure Google Authenticator.

I added these 2 line in my /etc/pam.d/sshd

Enable MFA using Google Authenticator PAM
auth required pam_google_authenticator.so nullok

Change ChallengeResponseAuthentication in my /etc/ssh/sshd_config

ChallengeResponseAuthentication yes

then I run google-authenticator command, scan the qr code using google authenticator app

Till now whole process is followed by using root user.

when I try to ssh as root user or any other user I am getting an error.

ex:

ssh root@la-stage-freeradius
Password:

I never set the password so I leave it blank by just pressing enter and getting this error.

root@la-stage-freeradius: Permission denied (publickey,keyboard-interactive).

/var/log/auth.log

Feb 19 05:00:37 la-stage-freeradius sshd(2331): pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.66.0.29  user=root
Feb 19 05:00:39 la-stage-freeradius sshd(2328): error: PAM: Authentication failure for root from 10.66.0.29
Feb 19 05:00:42 la-stage-freeradius sshd(2332): pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.66.0.29  user=root
Feb 19 05:00:44 la-stage-freeradius sshd(2328): error: PAM: Authentication failure for root from 10.66.0.29
Feb 19 05:00:54 la-stage-freeradius sshd(2333): pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.66.0.29  user=root
Feb 19 05:00:57 la-stage-freeradius sshd(2328): error: PAM: Authentication failure for root from 10.66.0.29
Feb 19 05:00:57 la-stage-freeradius sshd(2328): Connection closed by authenticating user root 10.66.0.29 port 49372 (preauth)

So what I am doing wrong here? how to use google-authenticator properly.