0

I've seen this but my situation is slightly different. Currently I edit the file like this:

  1. ssh HOST_1
  2. ssh HOST_2
  3. su OTHER_USER
  4. vim ~/FILENAME

How do I tell Emacs (using tramp) to edit this file, while including the hop from HOST_1 to HOST_2 as well as the su OTHER_USER?

"multi-hop" with "me" as the user works fine:

/sshx:HOST_1|sshx:HOST_2:/user/me/FILENAME

However, adding sudo su OTHER_USER fails:

/sshx:HOST_1|sshx:HOST_2|sudo:OTHER_USER@HOST_2:

After typing the final colon, I am prompted for a password. After entering the password, I can type the remote file path, but it appears to be an empty filesystem somewhere, with no folders or files at all.

The *Messages* buffer contains this:

Tramp: Encoding local file ‘/tmp/tramp.61Eexc.ulUhgA’ using ‘base64-encode-region’...done
Tramp: Decoding remote file ‘/ssh:HOST_2:/tmp/tramp.ulUhgA’ using ‘base64 -d -i >%s’...done

I've replicated this on my preferred Emacs setup (using sshx with spacemacs 0.200.13, Emacs 26.3) as well as a completely vanilla Emacs 25.2.2 (using ssh).

Alex Shroyer
  • 3,499
  • 2
  • 28
  • 54
  • Per the Q&A you linked to, that would typically be `/ssh:HOST_1|ssh:HOST_2|su:OTHER_USER@HOST_2:`. It's not obvious why you've indicated the `sshx` method here, unless you're using Windows? Nothing else in the question suggests that, though. I suspect you could use either `su:` or `sudo:`, but certainly try the other one if the first doesn't work for you. – phils Aug 13 '20 at 07:35
  • Start `emacs -Q` and try Tramp's multi-hop syntax. If it works, check your init files, which loaded package breaks this. – Michael Albinus Aug 13 '20 at 14:55
  • I can multi-hop (with my normal emacs config as well as `emacs -Q`) but when I multi-hop AND `sudo:otheruser@remote` it prompts for password and then seems to break. No file completion, no files at all. – Alex Shroyer Aug 13 '20 at 15:11
  • @phils the error message is there, but when I first started this question I hadn't waited long enough - after typing the 3rd colon, I can in fact access HOST_2's filesystem. Still having errors when trying to `sudo su OTHER_USER` though. I've edited the question to be more clear. – Alex Shroyer Aug 14 '20 at 14:34
  • I guess you want to set `tramp-verbose` to a higher value and then check the debug buffer, which will probably be named something like: `*debug tramp/sudo root@HOST_2*`. @MichaelAlbinus can advise better on the specifics -- I'm unsure how much verbosity would be appropriate here. – phils Aug 16 '20 at 00:53
  • Setting `tramp-verbose` to 6 shall be sufficient. – Michael Albinus Aug 17 '20 at 06:32

0 Answers0