5

To ssh, the server I am connecting to needs a password followed by an RSA-like key.

It goes:

Password:
Verification code:

I've read Tramp with 2-factor authentication, but it does not solve the problem completely.

I've appended "Verification code" into tramp-password-prompt-regexp.

But what happens when I try to login is that I get an opportunity to put in my password, and then I see:

Tramp: Sending Password
Tramp: Sending Verification code
Tramp: Sending Password
Tramp: Sending Verification code
Tramp: Sending Password
Tramp: Sending Verification code
Tramp: Waiting for prompts from remote shell...failed

Before it eventually fails. I feel like it's treating Verification code and Password as one and the same, and instead of prompting me for a Verification code, it just goes ahead and sends the password.

How do I get tramp to prompt a second time for the verification code? I want it to collect a second read-string from the user or something.

  • What happens, if you disable password caching? Let's say, try (setq password-cache nil). – Michael Albinus Oct 21 '15 at 19:29
  • That was a good idea. I was able to enter in my verification code. I then got the following error however. unix_listener: "/var/folders/jy/__string__/T/tramp.__string__.__username@domain__:22.__string__" too long for Unix domain socket – bernie Oct 21 '15 at 19:45
  • Yes, this is a known problem in Tramp reported as Emacs bugs 19702 and 21374. Solved (likely) in Emacs 24.5, solved for sure in Emacs 25.0.50 (the development version of Emacs). – Michael Albinus Oct 22 '15 at 8:10
  • I updated to 25.5.1 and I was able to login. Very cool feature. Thanks! – bernie Oct 22 '15 at 14:56
1

Solution (per Michael Albinus, above) for 2-factor authentication in Tramp:

  • upgrade Emacs to 24.5 or use Emacs development version 25.0.50 or later

Also see related answer.

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.