Emacs Tramp ssh double hop

| 有人可以帮我设置Emacs Tramp进行双跳吗? 我想在只能通过machine1.abc.def.edu连接到的machine2.abc.def.edu上工作。我的用户名是myname,在两台计算机上都是相同的。 我尝试添加.emacs:
(add-to-list \'tramp-default-proxies-alist
          \'(\"\\\\`machine2\\\\.abc\\\\.def\\\\.edu\\\\\'\"
            \"\\\\`myname\\\\\'\"
            \"/ssh:machine1\\\\.abc\\\\.def\\\\.edu:\"))
这是我对手册内容的最佳猜测。然后我做: C-x C-f /ssh:machine2.abc.def.edu 要么: C-x C-f /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
而且我的Aquamacs不能退出,而必须从外壳中杀死。。。这里有一个2年的线程,有同样的问题。我从那里尝试过答案:
(add-to-list \'tramp-default-proxies-alist
          \'(\"machine2.abc.def.edu\"
            nil
            \"/ssh:myname@machine1.abc.def.edu:\"))
具有相同的结果...对于所有组合我都可以想到...在machine1.abc.def.edu上进行远程编辑效果很好。     
已邀请:
好的,让我们尝试一些不同的事情,而无需打开隧道。 .emacs文件中的以下内容如何:
(add-to-list \'tramp-default-proxies-alist 
             \'(\"\\\\`machine2\\\\\'\" 
               nil 
               \"/ssh:%u@machine1.abc.def.edu:\"))
这与您在论坛帖子中找到的代码有两点不同: 它在目标主机周围添加刻度 名称(避免使用Emacs regexp语法 匹配部分名称) 它只使用 目标中的子域名 主持人(您在评论中进行了举报 下面,你不能SSH 使用完整版时的machine2 域名) 当您尝试访问machine2上的文件时,这有帮助吗?     
使用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
在此示例中,运行“ 5”将自动跳过endpoint1。     
设置从machine1到machine2的ssh隧道(假设sshd在machine2的端口22上运行):
machine1.abc.def.edu> ssh -f -N -L 2222:localhost:22 machine2.abc.def.edu
然后从Emacs这样连接到machine2:
/ssh:machine1.abc.def.edu#2222
或将以下行添加到您的.emacs中:
(add-to-list \'tramp-default-proxies-alist
             \'(\"\\\\`machine2\\\\.abc\\\\.def\\\\.edu\\\\\'\" nil
               \"/tunnel:machine1.abc.def.edu#2222:\"))
    

要回复问题请先登录注册