#71 timout on sftp connection

v1.0 (example)
open
nobody
None
5
2014-05-20
2014-05-19
Ralf Hauser
No

as per http://stackoverflow.com/questions/14830146/how-to-transfer-a-file-through-sftp-in-java , I try to connect, but it hangs forever.

openssl s_client -connect www.fonoteca.ch:990
however returns a prompt immediately.

Doing a
session.setTimeout(5000);
results in

com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out
at com.jcraft.jsch.Session.connect(Session.java:558)
at com.jcraft.jsch.Session.connect(Session.java:183)
...

Discussion

  • Ralf Hauser
    Ralf Hauser
    2014-05-19

    played around a little bit further, it appears that

    session.setSocketFactory(sfactory );

    is needed with an implementation of com.jcraft.jsch.SocketFactory that is based on javax.net.ssl.SSLSocketFactory

     
  • Ralf Hauser
    Ralf Hauser
    2014-05-19

    With FileZilla, I see

    Resp: 220 Welcome to Fonoteca Nazionale Svizzera FTP
    Sent: USER cSchreiber
    Resp: 331 Password required for cschreiber
    Sent: PASS *
    Resp: 230 Logged on
    Sent: SYST
    Resp: 215 UNIX emulated by FileZilla
    Sent: FEAT
    Resp: 211-Features:
    Resp: MDTM
    Resp: REST STREAM
    Resp: SIZE
    Resp: MLST type
    ;size;modify;
    Resp: MLSD
    Resp: AUTH SSL
    Resp: AUTH TLS
    Resp: PROT
    Resp: PBSZ
    Resp: UTF8
    Resp: CLNT
    Resp: MFMT
    Resp: 211 End
    Sent: PBSZ 0
    Resp: 200 PBSZ=0
    Sent: PROT P
    Resp: 200 Protection level set to P
    Status: connected
    Status: receiving directory content...
    Sent: PWD
    Resp: 257 "/" is current directory.
    Sent: TYPE I
    Resp: 200 Type set to I
    Sent: PASV
    Resp: 227 Entering Passive Mode (192,168,5,17,195,148)
    Status: Server sent Address for Passiv-Mode not routeable. using Serveraddress instead.
    Sent: MLSD
    Resp: 150 Opening data channel for directory listing of "/"
    Resp: 226 Successfully transferred "/"

     
  • Ralf Hauser
    Ralf Hauser
    2014-05-19

    JSch however sends in session.connect(): "SSH-2.0-JSCH-0.1.51"

    and gets the answer:

    500 Syntax error, command unrecognized.
    a FTP...