如何使用 Emacs tramp ssh 到远程主机并作为另一个用户临时编辑文件? [英] 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 曾经为我工作,现在它不见了,我很沮丧.
/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
/myuser@remotehost:sudo:anotheruser:/some/path/to/file
...并使用 ido-mode 工作.
...and have ido-mode work.
这里的关键是'myuser'、'remotehost' 和'anotheruser' 都是非常临时的,我使用了大量的远程主机,通常有不同的用户和 sudo-ing 到范围广泛的不同用户.
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.
我需要添加什么以及如何在不一遍又一遍地重新加载 emacs 的情况下对其进行测试?
What do I need to add and how can I test it without reloading emacs over and over?
推荐答案
As of 这次提交,TRAMP 再次支持 ad-hoc 多跳.
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
我还没有让它与 ido-mode
一起可靠地工作,这很遗憾,但总比没有好得多!:-)
I haven't got it to work reliably with ido-mode
yet, which is a shame, but it's a lot better than nothing! :-)
这篇关于如何使用 Emacs tramp ssh 到远程主机并作为另一个用户临时编辑文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!