rsync 通过ssh 出现"error in protocol data stream" (code 12)

分享于 

3分钟阅读

ubuntu

  繁體

问题

我试过:


rsync -v -v -e 'ssh -p YY' ./testfile me@XXXXX:/home



错误消息


opening connection using: ssh -p YY -l me 146.6.84.206 rsync ->-server -vvve.s . /home 


[sender] make_file(testfile,*,0)


send_file_list done


send_files starting


server_recv(2) starting pid=17537


rsync: connection unexpectedly closed (9 bytes received so far) [sender]


rsync error: error in rsync protocol data stream (code 12) at io.c(600)[sender=3.0.6]


_exit_cleanup(code=12, file=io.c, line=600): about to call exit(12)



这工作正常:


ssh -p YY me@XXXXX




答案1

如果指定了不存在的远程路径,也会获得这个错误...

在OS X:上出现这个错误


$ rsync -avz public/ static:apps/myapp.com


building file list ... done


rsync: connection unexpectedly closed (8 bytes received so far) [sender]


rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]



apps目录不存在,当我将它改为static:sites/myapp.com而不是(sites目录已存在)时,错误消失了...


答案2

目标主机上没有安装rsync时会出现这个错误, rsync: command not found


sudo apt-get install rsync



在目标主机上解决了问题...


答案3

看看这个


ssh -p YY me@XXXXX /bin/true > out.txt



如果out.txt包含数据,请在.profile.bashrc中标识有问题的语句,并将它包装到


if [ ! -t 1 ]; then


 echo garbage


fi




答案4

您可能需要输入ssh的完整路径,即


rsync -v -v -e '/usr/bin/ssh -p YY' ./testfile me@XXXXX:/home




答案5

如果远程系统上rsync的路径不是本地系统假定的路径,也会发生此错误... 您可以通过指定-vv来查看发生了什么...


答案6

我看到这个错误:


rsync -e 'ssh -v'



debug1: Exit status 11



...


rsync error: error in rsync protocol data stream (code 12) at /BuildRoot


/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/rsync/io.c(453)


[sender=2.6.9]



ssh到远程主机,发现它没有磁盘空间了。



数据  cod  str  proto  protocol  protoc