Linux – configure pam with ssh to do 2 factor authentication

linuxpamssh

I am trying to configure ssh with my custom radius server for authentication.

So what i want is, First it should authenticate with current ssh login (unix login) and then prompt user for second password for radius.

I am setting up /etc/pam.d/sshd as follows

auth        required    pam_unix.so debug

**auth       sufficient   /lib/security/pam_radius_auth.so  debug conf=/home/pam_radius try_first_pass**

But then my first authentication does not happen at all. It immediately goes for radius.

As per pam_radius ..try_first_pass

….If there was no previous password, or
the previous password
fails authentication, prompt the user with
"Enter RADIUS password: ", and ask for another
password.
Try this password, and return success/failure as
appropriate.

Best Answer

I can't reply to the comments of the other answer, but have you tried setting both auth lines to required instead of having radius be set as sufficient?