sftp fails with 'message too long' error

tomper picture tomper · Feb 1, 2015 · Viewed 11.4k times · Source

My java program uses ssh/sftp for transferring files into linux machines (obviously...), and my library for doing so is JSch (though it's not to blame).

Now, some of these linux machines, have shell login startup scripts, which tragically causes the ssh/sftp connection to fail, with the following message:

Received message too long 1349281116

After briefly reading about it, it's clearly a known ssh design issue (not a bug - see here). And all suggested solutions are on ssh-server side (i.e. disable scripts which output messages during shell login).

My question - is there on option to avoid this issue on client side?

Answer

R J picture R J · Feb 1, 2015

Check your .bashrc and .bash_profile on the server, remove anything that can echo. For now, comment the lines out.

Try again. You should not be seeing this message again.