Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Emacs tramp to ssh to a remote host and edit a file as another user on an ad-hoc basis?

/multi used to work for me, now it's gone and I'm frustrated.

What I want to do is, in my dream world:

/myuser@remotehost:sudo:anotheruser:/some/path/to/file

...and have ido-mode work.

The key thing here is that 'myuser', 'remotehost' and 'anotheruser' are all very ad-hoc, I use a huge array of remote hosts, often with different users and sudo-ing to a wide range of different users.

What do I need to add and how can I test it without reloading emacs over and over?

like image 755
Chris Withers Avatar asked Oct 20 '11 08:10

Chris Withers


1 Answers

As of this commit, TRAMP supports ad-hoc multiple hops again.

Roughly speaking, you use it like this:

/ssh:transituser@remotehost|sudo:user@remotehost:/some/file

I haven't got it to work reliably with ido-mode yet, which is a shame, but it's a lot better than nothing! :-)

like image 69
Chris Withers Avatar answered Nov 06 '22 02:11

Chris Withers