简体   繁体   English

如何创建“嵌套ssh隧道”?

[英]How to create a “Nested ssh tunnel”?

I connect to a linux server over 2 other server: 我通过另外2个服务器连接到linux服务器:

MyPC --(ssh)--> serverA --(ssh)--> serverB --(ssh)--> FinalServer

httpd is running on FinalServer, listen on 80 serverA/serverB only accept port 22, sshd service httpd在FinalServer上运行,在80 serverA / serverB上侦听,仅接受端口22,sshd服务

Is there any way to access FinalServer on myPC like this: 有没有办法像这样在myPC上访问FinalServer:

myPC> curl http://127.0.0.1:80
Hi , this is FinalServer Httpd Service!!
myPC> 

Thank you a lot!! 非常感谢!!

In principle, you would only need to tunnel port 80 at every ssh. 原则上,您只需要在每个ssh上建立端口80的通道。

So, at every step: ssh -L80:localhost:80 <next-host> . 因此,在每一步: ssh -L80:localhost:80 <next-host>

However, you will not be able to tunnel port 80 (and all ports < 1024) without root privileges, so you'll have to use a different port for this. 但是,如果没有root特权,您将无法通过隧道80端口(以及所有<1024端口),因此您必须为此使用其他端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM