Camden Narzt <[email protected]> writes:

Hi Camden,

> I have a host which requires 2FA to log into with ssh. It requires my
> ssh cert, and then I have to enter a TOTP code as well at a prompt.
> When
> I try to connect to it using tramp emacs's CPU use goes to 100% for
> several seconds and then tramp hangs.
>
> I reproduced the issue with a minimal config:
>
> starting from `emacs -Q` I ran the following in *scratch*:
>
> (require 'tramp)
> (tramp-cleanup-all-connections)
> (setq tramp-verbose 9)
> (setq tramp-password-prompt-regexp "^.*\\(passcode\\|pass ?
> phrase\\|passwor
> [dt]\\|wachtwoord\\|\343\203\221\343\202\271\343\203\257\343\203\274\343\203\211\\|Verification
> code\\).*:? *")
>
> Running `ssh -o ControlMaster=auto -o ControlPath=tramp.%C -o
> ControlPersist=no -e none secur-t.local` in the terminal connects
> fine.
>
> While connecting with tramp, emacs correctly prompts me for the 2fa
> code, so I believe that the modified tramp-password-prompt-regexp
> might be ok.
>
> Looking at *debug tramp/ssh secur-t.local* it seems like tramp gets
> stuck in a loop, the same messages get printed repeatedly for many
> thousands of lines. The whole buffer is 844397 lines for one attempt
> to
> connect.

The connection buffer shows

--8<---------------cut here---------------start------------->8---
([email protected]) Verification code:
Last login: Sat Mar 25 14:57:49 2023 from fe80::85b:effe:e0dd:7c6d%en0
%                                                                               
camdennarzt@upstream ~ % [?2004h
--8<---------------cut here---------------end--------------->8---

See the last line - this seems to be your prompt. Cannot be detected by
Tramp (is it zsh line editing prompt?). Please follow the
recommendations of the Tramp manual to set a safe prompt.

Best regards, Michael.

Reply via email to