1

I would like to upload a file from my local unix machine to a remote server that supports SFTP. I tried to implement using Ant script that used SCP task with sftp attribute set to true, but it didn't work, since it would always error out:

com.jcraft.jsch.JSchException: 4: Received message is too long: 1416128878.

If you can help me achieve that using shell script that should resolve the issue. Also will I have to install sftp or something on my local machine so that the script works?

Any help here would be greatly appreciated.

Cheers,
Ashley

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Ashley
  • 1,447
  • 3
  • 26
  • 52

1 Answers1

1

Your Ant script works. It's the server that does not work.

The server prints some message, thus violates SFTP protocol. Had you tried any standalone SFTP client, you will see that you are not able to connect.

The message starts Thin (0x ‭54 68 69 6E = ‭1416128878‬).

See also https://winscp.net/eng/docs/message_large_packet

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Yes you are correct. When i tried same using WInSCP tool that i just installed on my system, i wasn't able to connect, but it didn't error out, it just prints out something in a quick fashion and then disappears leaving me with the same login window. If that is so, what do i need to do at server end. – Ashley Aug 11 '16 at 14:21
  • The link in my answer describes the solution. – Martin Prikryl Aug 11 '16 at 14:33