when I try a scp transfer I get this error:
protocol error: bad mode
PD: I can establish a ssh connection.
So, this is a bit of question necromancy, but since I got here, and then realised what the answer was after reading the first answer, I figured I'd put this here for other wayward souls.
Because of the way scp works (over stdin/stdout over ssh AFAIK), having a naive bashrc that prints messages breaks the formatting scp is expecting, and thus the connection.
As suggested in various answers elsewhere (linked below), modifying your dot-files is usually the way to fix this:
the problem was a personalized welcome message of bash
Check the content of your .bashrc and .bash_login files. Make sure there's nothing that sends output to the tty.
In my case, I was running a command in my .bashrc to tell me what version of Linux I had. When I deleted that, everything worked fine.