问题描述
有人可以帮助我设置Emacs Tramp做双跳吗?我想在machine2.abc.def.edu上工作,我可以通过machine1.abc.def.edu连接。我的用户名是myname,在这两台机器上相同。
我试图添加.emacs:
(add-to-list'tramp-default-proxies-alist
'(\\`machine2\\.abc\\\\\\ \\.edu\\'
\\`myname\\'
/ssh:machine1\\.abc\\.def\\ \\ .edu:))
这是我最好的猜测手册中的内容。然后我做:
Cx Cf /ssh:machine2.abc.def.edu
或:
Cx Cf /ssh:[email protected]
但是两者都给出:
ssh:无法解析主机名ssh:提供nodename或servname,或者不知道
进程* tramp / scpc ssh *异常退出代码255
而我的Aquamacs不能退出,不得不从外壳杀死...有一个2年的线程在这里有同样的问题。我尝试过这个答案:
(add-to-list'tramp-default-proxies-alist
/ pre>
'(machine2.abc.def.edu
nil
/ssh:[email protected]:))
具有相同的结果...对于所有组合,我可以想出...在machine1.abc.def.edu上的远程编辑工作正常,但是。
解决方案好的,让我们尝试一下不同的东西,而不用打开一个隧道。 .emacs文件中的以下内容如下:
(add-to-list'tramp-default-proxies-alist
'(\\machine2\\\
nil
/ssh:%[email protected]:))
这与您在论坛帖子中发现的代码有两点不同:
- 它在目标主机周围添加ticks
name(Emacs regexp语法以避免
匹配部分名称)
- 它使用只有
目标中的子域名称
主机(您在一条评论中报告
以下,当您使用完整的
域名时,您不能ssh到
machine2)
当您尝试访问machine2上的文件时,有帮助吗?
Could somebody please help me setup Emacs Tramp to do a double hop?I want to work on machine2.abc.def.edu to which I can connect only through machine1.abc.def.edu. My username is myname, on both machines same.
I've tried to add .emacs:
(add-to-list 'tramp-default-proxies-alist '("\\`machine2\\.abc\\.def\\.edu\\'" "\\`myname\\'" "/ssh:machine1\\.abc\\.def\\.edu:"))
This is my best guess interpretation of what's in the manual. Then I do:C-x C-f /ssh:machine2.abc.def.eduor:C-x C-f /ssh:[email protected]
But both give:
ssh: Could not resolve hostname ssh: nodename nor servname provided, or not known Process *tramp/scpc ssh* exited abnormally with code 255
And my Aquamacs can't be quitted and have to killed from shell... There is a 2 years thread here with same question. I've tried the answer from there:
(add-to-list 'tramp-default-proxies-alist '("machine2.abc.def.edu" nil "/ssh:[email protected]:"))
With same results... also for all combinations I could come up with... Remote editing on machine1.abc.def.edu works fine, though.
解决方案Okay, let's try something different then, without opening a tunnel. How about the following in your .emacs file:
(add-to-list 'tramp-default-proxies-alist '("\\`machine2\\'" nil "/ssh:%[email protected]:"))
This is different from the code you found in the forum post in two points:
- it adds ticks around the target hostname (Emacs regexp syntax to avoidmatching partial names)
- it uses onlythe subdomain name in the targethost (you reported in a commentbelow that you cannot ssh tomachine2 when you use the fulldomain name)
Does that help when you try to access a file on machine2?
这篇关于Emacs Tramp ssh双跳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!