有人可以帮我设置Emacs Tramp做双跳吗?我想在machine2.abc.def.edu上工作,我只能通过machine1.abc.def.edu连接到它.我的用户名是myname,在两台机器上都是相同的.
我试过添加.emacs:
(add-to-list 'tramp-default-proxies-alist
'("\\`machine2\\.abc\\.def\\.edu\\'"
"\\`myname\\'"
"/ssh:machine1\\.abc\\.def\\.edu:"))
Run Code Online (Sandbox Code Playgroud)
这是我对手册中内容的最佳猜测.然后我做:Cx Cf /ssh:machine2.abc.def.edu或:Cx Cf /ssh:rsuhada@machine2.abc.def.edu
但两者都给出:
ssh: Could not resolve hostname ssh: nodename nor servname provided, or not known
Process *tramp/scpc ssh* exited abnormally with code 255
Run Code Online (Sandbox Code Playgroud)
我的Aquamacs不能退出,不得不从贝壳中杀死......这里有2年的线索,同样的问题.我从那里尝试过答案:
(add-to-list 'tramp-default-proxies-alist
'("machine2.abc.def.edu"
nil
"/ssh:myname@machine1.abc.def.edu:"))
Run Code Online (Sandbox Code Playgroud)
同样的结果......也可以用于所有组合......但是在machine1.abc.def.edu上进行远程编辑工作正常.
Mau*_*ord 10
答案是使用ssh_config中提供的ssh_proxy命令.记录在这里和这里.基本上,您在ssh文件夹中创建一个配置文件,您可以在其中编写快捷方式.您的一个快捷方式是通过另一个端点使用代理.所有快捷方式都适用于使用ssh的任何工具,包括git和emacs.
Host endpoint2
User myusername
HostName mysite.com
Port 3000
ProxyCommand ssh endpoint1 nc -w300 %h %p
Host endpoint1
User somename
HostName otherdomainorip.com
Port 6893
Run Code Online (Sandbox Code Playgroud)
在此示例中,运行ssh endpoint2将自动跳过endpoint1.
好吧,让我们尝试一些不同的东西,而不是打开隧道。.emacs 文件中的以下内容怎么样:
(add-to-list 'tramp-default-proxies-alist
'("\\`machine2\\'"
nil
"/ssh:%u@machine1.abc.def.edu:"))
Run Code Online (Sandbox Code Playgroud)
这与您在论坛帖子中找到的代码有两点不同:
当您尝试访问 machine2 上的文件时,这有帮助吗?
| 归档时间: |
|
| 查看次数: |
2276 次 |
| 最近记录: |