TRAMP + Sudo infinite loop weirdness

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

TRAMP + Sudo infinite loop weirdness

Vlad
Dear tramp-devel Team,

I'm having a though time editing files with emacs (GNU Emacs 27.1 (build
1, x86_64-pc-linux-gnu) of 2020-09-26) as sudo on my server (FreeBSD 12).
The SSH connection is established via ssh-keys.

Editing files via Tramp (find-file "ssh:user@machine:/") everything 100%
works, however, doing (find-file "ssh:user@machine|sudo:root@machine:/")
does not work *most of the time*. One out of 20 of entering this
find-file command, I get the remote password prompt to enter my remote
user's password to get a tramp connection with sudo privileges. However,
most of the time, Tramp produces trash inputs into the password field by
itself, instead of giving me the password prompt. As a result, either
nothing happens or emacs get's stuck in a loop and C-g crashes emacs.

"tramp-verbose 10" reveals the culprit being a repeated series of "exec
sudo -u root -s -H -p P""a""s""s""w""o""r""d"": /bin/sh"
"^[[?2004lPassword:" "Sorry, try again." instead of giving me the
password prompt.

Full verbose log attached to this mail.

Anything I can do to stop tramp from acting up?

Best regards,


Vlad


tramp.debug (578K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TRAMP + Sudo infinite loop weirdness

Michael Albinus
Vlad <[hidden email]> writes:

> Dear tramp-devel Team,

Hi Vlad,

> I'm having a though time editing files with emacs (GNU Emacs 27.1 (build
> 1, x86_64-pc-linux-gnu) of 2020-09-26) as sudo on my server (FreeBSD 12).
> The SSH connection is established via ssh-keys.
>
> Editing files via Tramp (find-file "ssh:user@machine:/") everything 100%
> works, however, doing (find-file "ssh:user@machine|sudo:root@machine:/")
> does not work *most of the time*. One out of 20 of entering this
> find-file command, I get the remote password prompt to enter my remote
> user's password to get a tramp connection with sudo privileges. However,
> most of the time, Tramp produces trash inputs into the password field by
> itself, instead of giving me the password prompt. As a result, either
> nothing happens or emacs get's stuck in a loop and C-g crashes emacs.
>
> "tramp-verbose 10" reveals the culprit being a repeated series of "exec
> sudo -u root -s -H -p P""a""s""s""w""o""r""d"": /bin/sh"
> "^[[?2004lPassword:" "Sorry, try again." instead of giving me the
> password prompt.
>
> Full verbose log attached to this mail.
>
> Anything I can do to stop tramp from acting up?

You have nasty escape seqences in your shell output, like this:

--8<---------------cut here---------------start------------->8---
[?2004hflan@flandre /u/h/flan>
--8<---------------cut here---------------end--------------->8---

2004h, for example, stands for bracketed paste mode. Can you convince
your remote shell to suppress it? The Tramp manual speaks about
techniques.

> Best regards,
>
> Vlad

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: TRAMP + Sudo infinite loop weirdness

Vlad
Many thanks! This info solved my problem.
It seems my shell "fish" was at fault. I did not catch unto this,
because it worked when connecting as non-sudo.

Initially I changed my shell from fish, back to csh. This solved the issue.
Then I read up in the tramp manual, that /bin/sh is requested, when
connecting via the "sshx" or the "plink" method.
Switching the command from ssh to sshx finally solved the problem
properly. I now have my fish shell back and sshx properly requests
/bin/sh. Edit as sudo now works properly.

Best regards,

Vlad


On 11/03/2021 14:50, Michael Albinus wrote:

> Vlad <[hidden email]> writes:
>
>> Dear tramp-devel Team,
> Hi Vlad,
>
>> I'm having a though time editing files with emacs (GNU Emacs 27.1 (build
>> 1, x86_64-pc-linux-gnu) of 2020-09-26) as sudo on my server (FreeBSD 12).
>> The SSH connection is established via ssh-keys.
>>
>> Editing files via Tramp (find-file "ssh:user@machine:/") everything 100%
>> works, however, doing (find-file "ssh:user@machine|sudo:root@machine:/")
>> does not work *most of the time*. One out of 20 of entering this
>> find-file command, I get the remote password prompt to enter my remote
>> user's password to get a tramp connection with sudo privileges. However,
>> most of the time, Tramp produces trash inputs into the password field by
>> itself, instead of giving me the password prompt. As a result, either
>> nothing happens or emacs get's stuck in a loop and C-g crashes emacs.
>>
>> "tramp-verbose 10" reveals the culprit being a repeated series of "exec
>> sudo -u root -s -H -p P""a""s""s""w""o""r""d"": /bin/sh"
>> "^[[?2004lPassword:" "Sorry, try again." instead of giving me the
>> password prompt.
>>
>> Full verbose log attached to this mail.
>>
>> Anything I can do to stop tramp from acting up?
> You have nasty escape seqences in your shell output, like this:
>
> --8<---------------cut here---------------start------------->8---
> [?2004hflan@flandre /u/h/flan>
> --8<---------------cut here---------------end--------------->8---
>
> 2004h, for example, stands for bracketed paste mode. Can you convince
> your remote shell to suppress it? The Tramp manual speaks about
> techniques.
>
>> Best regards,
>>
>> Vlad
> Best regards, Michael.