Emacs Tramp ssh double hop

前端 未结 3 1800
傲寒
傲寒 2021-01-13 13:31

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 usern

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-13 14:13

    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?

提交回复
热议问题