[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question on tramp multi-hop
From: |
Michael Albinus |
Subject: |
Re: question on tramp multi-hop |
Date: |
Wed, 27 May 2020 09:10:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Alex Koval <address@hidden> writes:
> Hi Michael,
Hi Alex,
> Sorry, it looks like I mistakenly wrongly formulated my question. Let me
> start over:
>
> 1. /ssh:host1.mydomain.edu|sudo:host1.mydomain.edu:/etc/somefile.txt
> Works fine
>
> 1. /ssh:host1.mydomain.edu|sudo:host1.mydomain.edu|ssh:slave:/etc/somefile.txt
> Works fine
>
> 2. /ssh:host2.mydomain.edu|sudo:host2.mydomain.edu:/etc/somefile.txt
> Works fine
>
> 2. /ssh:host2.mydomain.edu|sudo:host2.mydomain.edu|ssh:slave:/etc/somefile.txt
> WRONGLY opens file on host1
Yes, this makes more sense.
When you use ad-hoc multi-hops, Tramp caches for every target host the
hops it needs to go there. Likely, in the latter case it uses its cached
values for "slave" from the second line.
I recommend, that you add aliases "slave1" and "slave2" on host1 and
host2. This could be either in /etc/hosts, or in ~/.ssh/config of the
root user. And then you apply
/ssh:host1.mydomain.edu|sudo:host1.mydomain.edu|ssh:slave1:/etc/somefile.txt
/ssh:host2.mydomain.edu|sudo:host2.mydomain.edu|ssh:slave2:/etc/somefile.txt
Since these are very long file names, you might declare Tramp aliases
for them. See the discussion in the Tramp manual, chapter "Frequently
Asked Questions". And don't forget to enable `tramp-save-ad-hoc-proxies'.
> WBR, Alex
Best regards, Michael.