Re: Emacs Tramp hangs with timeout when connecting to server with two-factor authentication from a Windows 11 machine via sshx/scpx

Michael Albinus <[email protected]> Mon, 24 Nov 2025 18:34:17 +0100
Newsgroups gmane.emacs.tramp
Message-ID <[email protected]>
Alexei Srour <[email protected]> writes:

> Hi Michael,

Hi Alexei,

>> I suppose the question for the verification code falls into this
>>   category. Perhaps you try the "plink" method instead of "sshx"?
>
> I've now tried `plink` and `plinkx`. Thankfully, after setting up a
> profile for PuTTY, `plinkx` has succeeded connecting with OTP enabled,
> complete with prompt and all (I have yet to attempt with a password).
> The default `plink` method seems to fail, and I believe it has to do
> with the absent `-t` flag necessary for allocating a pty.

??? With the plink method, something like this is sent:

=2D-8<---------------cut here---------------start------------->8---
plink -l albinus -ssh -share -legacy-stdio-prompts -t freebsd14 " env 'TER=
M=3Ddumb' 'PROMPT_COMMAND=3D' 'PS1=3D#$ ' /bin/sh  -i " && exit || exit
=2D-8<---------------cut here---------------end--------------->8---

> I will also note that, interestingly, invoking `plink` from Emacs
> Shell hangs unless the `-t` flag is included, at which point it will
> correctly provide a prompt for the OTP and even let me log in. This is
> farther than `ssh` could get, and has me thinking that perhaps it's
> Emacs' handling of OTP prompts causing problems, not Tramp.

Again, why do you believe '-t' is missing?

> As excited as I am for this development, this is ultimately a
> suboptimal solution, as viewing large files creates a warning of no
> "inline methods" available for transfer and taking an age to cache the
> file on my local machine. Moreover, I don't like depending on an
> "external" dependency that doesn't exist by default on Windows, so I'd
> still like to see `scpx` as a working alternative. Nevertheless, I
> suspect whatever functionality that exists within Emacs when handling
> the OTP prompt via `plinkx` may hint at a solution.=20

I'm not sure that the warning about "inline methods" doesn't happen for
sshx.

You might also consider to use pscp or psftp instead.

> Regards,
> Alexei

Best regards, Michael.