简体   繁体   中英

How to create a “Nested ssh tunnel”?

I connect to a linux server over 2 other server:

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

httpd is running on FinalServer, listen on 80 serverA/serverB only accept port 22, sshd service

Is there any way to access FinalServer on myPC like this:

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.

So, at every step: 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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