且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过Java中的SSH隧道运行远程命令

更新时间:2023-01-20 07:55:52

当然,如果你设置 rhost =localhost,连接将到达SSH服务器,而不是资源服务器。
输入正确的主机名,这应该没问题。 (我这样做了一次。)

Of course, if you set rhost = "localhost", the connection will arrive at the SSH server, and not at the "Resource" server. Put the right host name in, and it should be no problem. (I did this once.)

如果你想从JSch做两个连接,而不是做本地端口转发,然后连接到这个转发端口,你可以使用我的 ProxySSH 类,找到在JSch wiki中。 (我也是这样做的,就像你在那里一样。)

If you want to do both connections from JSch, instead of doing a local port forwarding and then connecting to this forwarded port, you can use my ProxySSH class, to find in the JSch wiki. (I did this, too, in a similar situation like you have there.)