I am attempting to edit a remote file in Emacs, and I'm having trouble getting from the documentation and previous SO questions to doing the thing I want.
I'm working remotely, from a variety of locations, and I want to edit files on server Foo. Server Foo isn't directly reachable from the Internet, but server Bar is, and Foo accepts connections from Bar. I can count on reaching Bar, and Bar can count on reaching Foo.
The Tramp documentation tells me that I need to add to Tramp's proxy list to do this, and that it should look like the following:
(add-to-list 'tramp-default-proxies-alist
("foo_host" "seanm" "/ssh:seanm@bar_host"))
However, when I try that, it doesn't work, and I get inscrutable error messages.
How can I unambiguously refer to Foo? There is no DNS server that knows how to find Foo from its hostname, and Foo's IP address is in the 10.0.0.0/8 private space. I don't want to refer to Foo by that IP address, because that risks colliding with hosts in other 10.0.0.0/8 networks I may visit. As a kludge, I added Foo to Bar's /etc/hosts file, but that didn't seem to work. Is there a better solution?
What quoting rules do I need to adhere to? The examples that I'm seeing use both "double quotes" and `tick-and-single' quotes, the latter apparently requiring double-backslash escaping. I don't understand what's going on there - it seems like there are multiple layers of parsing that this string is going to be shoved through.
While trying variations on this, I've gotten error messages that amount to "you can't use that remote-access method for that scenario." How can I set up a second proxy method that will let me do the equivalent of C-x C-f
/su::/path/to/file
?
It all seems very painful compared to the previous multi-hop syntax.
Later: I was able to get the many layers of escaping right so that emacs correctly 'hears' the names of hosts. However, I can't get any hops beyond a second to work correctly, which is a very disappointing lapse in functionality.
Host
alias with aProxyCommand
option; you'll find plenty of examples on Super User, Unix or Server Fault. – Gilles 'SO- stop being evil'/su::/path/to/file
. – Brighid McDonnell