Reverse SSH tunnel with JSCH Java [closed]

你离开我真会死。 提交于 2019-12-22 15:33:24

问题


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 username@yourMachine-ipaddress


回答1:


There is an example gist that shows how to do it here: https://gist.github.com/ymnk/2318108#file-portforwardingr-java

The method you want to look at is session.setPortForwardingR()

session.setPortForwardingR(rport, lhost, lport);


来源:https://stackoverflow.com/questions/27883491/reverse-ssh-tunnel-with-jsch-java

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