使用JSCH Java反向SSH隧道 [英] Reverse SSH tunnel with JSCH Java
本文介绍了使用JSCH Java反向SSH隧道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用JSCH进行反向ssh连接?如果不是,是否还有其他纯Java库可用于进行反向隧道SSH连接?
Is it possible to do a reverse ssh connection using JSCH? If it is not, is there any other pure Java library that I can use to do a reverse tunnel SSH connection?
我想模仿的命令类似于:
The command I want to mimic is similar than:
ssh -fN -R 7000:localhost:22用户名@ yourMachine-ipaddress
推荐答案
有一个示例要点,说明如何在此处执行此操作:
https://gist.github.com/ymnk/2318108#file-portforwardingr-java
There is an example gist that shows how to do it here: https://gist.github.com/ymnk/2318108#file-portforwardingr-java
您要查看的方法是session.setPortForwardingR()
The method you want to look at is session.setPortForwardingR()
session.setPortForwardingR(rport, lhost, lport);
这篇关于使用JSCH Java反向SSH隧道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文