Emacs Tramp ssh双跳 [英] Emacs Tramp ssh double hop

查看:128
本文介绍了Emacs Tramp ssh双跳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我设置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:rsuhada@machine2.abc.def.edu



但是两者都给出:

  ssh:无法解析主机名ssh:提供nodename或servname,或者不知道
进程* tramp / scpc ssh *异常退出代码255

而我的Aquamacs不能退出,不得不从外壳杀死...有一个2年的线程在这里有同样的问题。我尝试过这个答案:

 (add-to-list'tramp-default-proxies-alist 
'(machine2.abc.def.edu
nil
/ssh:myname@machine1.abc.def.edu:))
/ pre>

具有相同的结果...对于所有组合,我可以想出...在machine1.abc.def.edu上的远程编辑工作正常,但是。

解决方案

好的,让我们尝试一下不同的东西,而不用打开一个隧道。 .emacs文件中的以下内容如下:

 (add-to-list'tramp-default-proxies-alist 
'(\\machine2\\\
nil
/ssh:%u@machine1.abc.def.edu:))

这与您在论坛帖子中发现的代码有两点不同:


  1. 它在目标主机周围添加ticks
    name(Emacs regexp语法以避免
    匹配部分名称)

  2. 它使用只有
    目标中的子域名称
    主机(您在一条评论中报告
    以下,当您使用完整的
    域名时,您不能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.edu or: C-x C-f /ssh:rsuhada@machine2.abc.def.edu

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:myname@machine1.abc.def.edu:"))

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:%u@machine1.abc.def.edu:"))

This is different from the code you found in the forum post in two points:

  1. it adds ticks around the target host name (Emacs regexp syntax to avoid matching partial names)
  2. it uses only the subdomain name in the target host (you reported in a comment below that you cannot ssh to machine2 when you use the full domain name)

Does that help when you try to access a file on machine2?

这篇关于Emacs Tramp ssh双跳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆