On Linux, I would like to to set up a user account in such a way that the user would have to enter 2 passwords to log in. Is this possible, and what would be the implications of this?

  • 1
    What is the advantage of having to enter two passwords to login (unless you really hate your users) – Ed Heal Jul 17 '15 at 8:07
  • you may wish to alter password complexity i.e. 36 char long, with 3 uppercase, 4 special char and all. to be change every fortnight, no reusing last 100 password. – Archemar Jul 17 '15 at 8:30
  • Possible duplicate of How to configure pam to use with two different passwords? – roaima Jul 17 '15 at 9:28

Reading between the lines, what you want to configure is two-factor authentication. This will require an additional "piece of information" in addition to the password for the user to log in.

There are a multitude of ways of implementing it, but a few popular options are:

In both cases, PAM modules are available so all system logins (console, ssh, etc) can be configured to use two-factor authentication.


A quick search turned up Two Factor SSH Setup which is a simple walkthrough of the steps required for setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.