tramp: Ad-hoc multi-hops
5.3 Declaring multiple hops in the file name
============================================
TRAMP file name syntax can accommodate ad hoc specification of multiple
proxies without using ‘tramp-default-proxies-alist’ configuration
setup(Multi-hops).
Each proxy is specified using the same syntax as the remote host
specification minus the file name part. Each hop is separated by a ‘|’.
Chain the proxies from the starting host to the destination remote host
name and file name. For example, hopping over a single proxy
‘bird@bastion’ to a remote file on ‘you@remotehost’:
C-x C-f /ssh:bird@bastion|ssh:you@remotehost:/path
Proxies can take patterns ‘%h’ or ‘%u’.
TRAMP adds the ad-hoc definitions on the fly to
‘tramp-default-proxies-alist’ and is available for re-use during that
Emacs session. Subsequent TRAMP connections to the same remote host can
then use the shortcut form: ‘/ssh:you@remotehost:/path’.
-- User Option: tramp-save-ad-hoc-proxies
For ad-hoc definitions to be saved automatically in
‘tramp-default-proxies-alist’ for future Emacs sessions, set
‘tramp-save-ad-hoc-proxies’.
(setq tramp-save-ad-hoc-proxies t)