sftp gives the error “Received message too long”

Question:

sftp gives the error “Received message too long”

Answer:

Check your .bashrc file. You likely have something in your .bashrc that is sending output and killing sftp. Most items that send output belong in .bash_profile.

The primary difference between .bashrc and .bash_profile is that .bashrc is used for non-interactive logins (sftp, etc.) and .bash_profile is used for interactive logins.

Keep your .bashrc free of anything that would send output.