Take the 2-minute tour ×  I was able to do sftp yesterday to a
RHEL 5.4 box (RedHat) and today I can't.  The message is
"Received message too long 778199411", and after some
investigation, it was due to my RHEL box's .bashrc having a line
echo "running .bashrc" -- or echoing anything at all, I think.
So why would printing out a line affect sftp? It felt a bit like
a design issue as printing out a line in .bashrc works in other
situations such as log in or ssh and it is kind of hard to track
down when sftp fails for such a weird reason.  So the question
is, why printing out a line cause such error and what if we
still like to print out something in .bashrc? (mainly to see
when this file get sourced/executed).  share|improve this
question add comment  1 Answer  This is a longstanding problem.
I found it ten years ago when I first had to mix commercial SSH
at work and open-SSH at home. I ran into it again today and
found this post.  If I had searched for "sftp/scp fails but ssh
is OK" I would have been reminded