protocol error : expected control record

Ángel González keisial at
Thu Mar 20 07:46:09 EST 2014

On 17/03/14 11:48, RAVI PRATAP Singh wrote:
> Hi All,
> During scp, I am seeing this message
> protocol error : expected control record
> This message came because scp sink was expecting the message starting from
> 'C' or 'D' , something like C0644 299 group or D0755 0 docs but during dns
> query we were printing "Using IP address" message on the stdout.
> So , the message in the buffer was "Using IP address" and thus message
> "protocol error : expected control record" was thrown.
> Is openssh scp should always expect 'Cmmmm' or 'Dmmmm' messages ? Is fix
> available for taking care scenario where on stdout something is printed.
> Thanks
> Ravi Pratap

That's a known drawback of scp, messages on stdout by other programs 
interfere with it. The “solution” is to .use sftp instead.
Anyway, you should only be printing that message on interactive sessions.

Commands like:
ssh myhost "cat /etc/passwd" > passwd-copy
shouldn't be prefixed with the ip address you were using :)

More information about the openssh-unix-dev mailing list