Hello,
I am trying to to forward the port 22 of host B to the port 51501 on host
A. I got no error but if I try to connect to host A on port 51501 I get a
connection refused :
ssh -p 51501
ssh: connect to host prod port 51501: Connection refused
here is my code
String host="A";
String user="user";;
int port=22;
int tunnelLocalPort=51501;
String tunnelRemoteHost="B";
int tunnelRemotePort=22;
JSch jsch=new JSch();
session=jsch.getSession(user, host, port);
MyUser lui=new MyUser();
session.setUserInfo(lui);
session.connect();
//session.setPortForwardingL(tunnelLocalPort,tunnelRemoteHost,tunnelRemotePort);
session.setPortForwardingL("0.0.0.0",tunnelLocalPort,tunnelRemoteHost,tunnelRemotePort);
System.out.println("Connected");
If I try to set up manualy :
I connect to host A and then execute :
ssh -Ng -L 50123:localhost:22 u...@b
then if I try to connect to host A on port 50123 it works
running netstats on host A :
netstat -an | grep 50123
tcp 0 0 0.0.0.0:50123 0.0.0.0:* LISTEN
When using jsch I have no error/ exception, but if I run "netstat -an | grep
51501 " it is empty...
What am I doing wrong ? The example look simple but I can't achieve to make
it works....
Thanks for help !
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users