I need to use Tramp to connect to a server that has 2-factor authentication.

When I log in from the command line or from I get a message asking me to press 1 (and hit enter) which then sends a popup message to my phone asking me to approve the log in.

I can't figure out how to get Tramp to let me interact with the command prompt after it tries to connect. I get a buffer that says "Passcode or option (1-1):" but I can't figure out how to enter a value to have Tramp send back to the server.

  • That sounds really cool. How is the two-factor authentication done? I'm interested in setting up something myself.
    – PythonNut
    Commented Sep 13, 2015 at 20:38
  • I am using this: duosecurity.com/docs/duounix It works pretty well so far. It's free for the sort of small scale thing I have set up. Commented Sep 14, 2015 at 4:31

1 Answer 1


You'll have to customize the tramp-password-prompt-regexp variable with the second prompt to finish the 2-factor authentication. The remote shell setup part of the manual has a simple example.

This is not a new feature but an old feature that you adapt to the second prompt of the 2-factor authentication. This same facility was used in days of yore for entering some secret date or random number or mother's maiden name.

  • 3
    Man, I wish I was around during the days of yore.
    – PythonNut
    Commented Sep 14, 2015 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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