SSH through multiple hosts to execute another ssh session [closed]

强颜欢笑 提交于 2019-12-09 14:14:34

问题


I spent to much time trying to do something which in plain words looks simple

I am at home, without firewall and all open ports. I need to ssh to the router at work where I have access to ssh port 22. My personal machine is on that subnet having internal ip address. So, what I need to do is to ssh from one machine to the second and from the second to the third. On the third I need to execute another ssh which tunnels some ports to my home machine. All that in bash script from my home. I have tried many solutions on the internet but nothing works.

The whole ideal is to get to my PC at work and run ssh tunnel for port 22 which will allow me to sshfs my work PC.

I could do it manually, by sshing to the router, that form the router to the work pc and then execute the ssh tunnel. I need a one-click solution.

Thanks in advance!


回答1:


Have you tried just stacking the ssh commands like ssh -t localhost ssh localhost be sure to add the -t option for each hop except the last one ssh -t localhost ssh -t localhost ssh localhost




回答2:


Maybe try VNC? With the right setup/port forwarding, you wouldn't have to jump from 1 PC to the next.



来源:https://stackoverflow.com/questions/15161794/ssh-through-multiple-hosts-to-execute-another-ssh-session

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!