Emacs Tramp ssh double hop

前端 未结 3 1799
傲寒
傲寒 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:12

    The answer it to use the ssh_proxy command available in ssh_config. Documented here and here. Basically you create a config file in your ssh folder that you can write shortcuts in. One of your shortcuts is to use a proxy through another end point. All of your shortcuts work for any tool that uses ssh including git and 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
    

    In this example running ssh endpoint2 will automatically hop through endpoint1.

提交回复
热议问题