2

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

user1618465
  • 1,813
  • 2
  • 32
  • 58

1 Answers1

3

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);
Joe Young
  • 5,749
  • 3
  • 28
  • 27