JSch forces packet size to exceed maximum allowed error

I am trying to use the JSch class ( Java Secure Channel ; jsch-0.1.50.jar) to connect to an SFTP server and send the file from the ColdFusion application (9.0.2) (which runs on Java 1.7.0_15). The main code in question is:

jsch = classLoader.create("com.jcraft.jsch.JSch").init(); // ColdFusion-specific to load the jar jschSession = jsch.getSession("myusername", "ftp.example.com", 22); jschSession.setConfig("StrictHostKeyChecking", "no"); jschSession.setTimeout(60000); jschSession.setPassword("mypassword"); jschSession.connect(); 

After connecting to Serv-U to the SFTP server, it causes the following error on the Serv-U side immediately after opening the connection:

 SSH Protocol Error: packet size exceeds maximum allowed. 

Serv-U then closes the session, after which JSch throws an exception:

 Session.connect: java.io.IOException: End of IO Stream Read 

I am new to the JSch class and maybe I am missing something obvious, but I don’t understand where the error might be. Connecting to the same SFTP server from the same source with WinSCP gives no errors. Any tips on what the code is doing wrong or where to go for troubleshooting?

+4
source share
1 answer
 SSH Protocol Error: packet size exceeds maximum allowed 

This means that the local client received some data from a remote server that was not properly formatted as an SFTP protocol message. The usual reason is that the server sent some kind of text message through an SSH connection. There are several things that can happen:

  • Your .bashrc, .bash_profile or similar shell configuration file on the server is configured to print some message.
  • The server is badly configured and sends some kind of greeting.
  • The server sends an error message.

If you have access to the ssh command-line utility, you can use it to see what the server is sending. Run something like this:

 $ ssh myusername@ftp.example.com -s sftp 

This will open a simple SSH session on the remote server and request the SFTP subsystem, which will be the same as the SFTP client. If the server starts SFTP correctly, you will not see any output from this command - it will just wait until you kill it. If you see any text from a remote server, this is a problem. You need to find out why the server sends this text and prevents it.

0
source

Source: https://habr.com/ru/post/1483692/


All Articles