简体   繁体   English

循环SSH隧道

[英]Circular SSH Tunnel

Is is possible to create a circular SSH Tunnel? 是否可以创建循环SSH隧道?

local1 >SSH_TUNNEL> remote1 >SSH_TUNNEL> local1 local1> SSH_TUNNEL>远程1> SSH_TUNNEL> local1

On "Remote1" I create a TAR that I want to pipe to STDOUT ( - ) ... can I then TAR - . 在“ Remote1”上,我创建了一个我想通过管道传输到STDOUT(-)的TAR,然后可以将TAR-传输给我。 | | >SSH_TUNNEL> local1 > SSH_TUNNEL>本地1

ssh user@remote1 "tar -cvf - . | ssh user@local1"

I've googled and forum'd and googled some more ... I can't seem to find the answer. 我已经搜索了Google论坛,然后搜索了更多Google搜索……我似乎找不到答案。 Also, I did find references like this: 另外,我确实找到了这样的参考:

SSH Tunnel Complex SSH隧道综合体

But it has low votes and the owner didn't mark it as correct ... I'm not even sure if that applies to my issue. 但是它的票数很低,所有者没有将其标记为正确的……我什至不确定这是否适用于我的问题。

Any ideas and/or suggestions are welcome! 欢迎任何想法和/或建议!

Thanks! 谢谢!

Yes, you can, and I know why you might want to do this. 是的,您可以,而且我知道您为什么要这样做。 The listed command is rather silly, but still ... 列出的命令相当愚蠢,但仍然...

ssh -R2222:127.0.0.1:22 user@remote1 "tar -cvf - . | ssh user@local1:2222 (whatever)"

If you do this more than once you will have public key headaches to cleanup. 如果您多次执行此操作,则将面临公钥清理的麻烦。 I don't know any good way around this save editing .ssh/known_hosts every time. 我不知道有什么好的方法可以解决每次保存.ssh / known_hosts的问题。

The listed objective is better achieved as 列出的目标可以更好地实现,因为

ssh user@remote1 "tar -cvf - ." | (whatever)

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

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