JSCH PortForwarding Issue


  • Anonymous

    Greetings everyone,
    I am currently using JSCH to connect through SSH to a remote server(let's say I would like to use port forwading to connect to a PC which is connected locally to the remote server. I am using the setPortForwardingL() function in two cases:
    "session.setPortForwardingL(40021,"","21");" and
    I am able to connect to the local PC( using telnet on port 40023, but when I try to connect with an FTP client(WinSCP or FileZilla) it hangs after the "PASSIVE mode" message, as is showed in the below message:

    Status: Resolving address of localhost
    Status: Connecting to…
    Status: Connection established, waiting for welcome message…
    Response: 220 Welcome to the FTP service.
    Command: USER oracle
    Response: 331 Please specify the password.
    Command: PASS ********
    Response: 230 Login successful.
    Command: SYST
    Response: 215 UNIX Type: L8
    Command: FEAT
    Response: 211-Features:
    Response: EPRT
    Response: EPSV
    Response: MDTM
    Response: PASV
    Response: REST STREAM
    Response: SIZE
    Response: TVFS
    Response: 211 End
    Status: Connected
    Status: Retrieving directory listing…
    Command: PWD
    Response: 257 "/"
    Command: TYPE I
    Response: 200 Switching to Binary mode.
    Command: PASV
    Response: 227 Entering Passive Mode (10,8,0,58,57,70)
    Command: LIST

    It hangs there and then gives me an error message. I believe it has to do something with that the response packets sent from the local server to the remote server, which are not forwarded back to my application through the SSH channel. Any help is appreciated.
    Thanks in advance,
    Thank you