I'm wondering if there is some kine of 2 factor authentication module which supports PAM. My dovecot(PAM), postfix(SASL) and openssh authenticate via PAM to the system users. I would like to have it do 2 factor authentication, maybe via yubikey, google authenticator or whatever. And also, how would my mail client handle that?

  • 2
    Repeatedly editing your post to be junk is not appropriate, please stop doing that. Jun 10, 2019 at 14:13
  • @Ward I see the edits, why would OP do that though? Sep 2, 2019 at 12:50
  • 1
    @Joseph It happens sometimes, when a person is unhappy with the response to their question (or sometimes with another question on the site or another SE site) and they decide to leave SE but want to take their content with them. Sep 2, 2019 at 12:59

2 Answers 2


Really, you want to choose the proper authentication protocol that is supported by PAM, the services you want to protect and the broadest number of two-factor authentication servers.

Radius is the answer.

All major two-factor authentication systems support radius. Radius is supported in PAM through the pam-radius plugin. Radius will also allow you to proxy the requests through freeradius (or NPS on AD) which can then perform authorization against your directory. (Meaning that you have one location to disable users.)

We have a number of tutorials that should help: a couple on pam-radius: https://www.wikidsystems.com/support/wikid-support-center/how-to/pam-radius-how-to & https://www.wikidsystems.com/support/wikid-support-center/how-to/how-to-configure-pam-radius-in-ubuntu

And this one on adding two-factor auth to webmail that covers sasl etc. https://www.wikidsystems.com/support/wikid-support-center/how-to/how-to-configure-webmail-for-wikid-strong-authentication

The email clients will be prompted for an OTP each time they launch or for each session.

Pam-tacacs and pam-ldap would be other options, but more difficult and less flexible, IMO.


Google Authenticator has a PAM module. The instructions for it are here. I'm not sure how it would work with mail.

You must log in to answer this question.