按照此处给出的说明进行 rsync 备份时:http : //troy.jdmz.net/rsync/index.html
我收到错误消息“协议版本不匹配——你的外壳干净吗?”
我在某处读到我需要使提示 (PS1="") 和 motd (.hushlogin) 显示静音才能解决这个问题。我这样做了,提示和登录横幅(MOTD)不再出现,但运行时仍然出现错误:
rsync -avvvz -e "ssh -i /home/thisuser/cron/thishost-rsync-key" remoteuser@remotehost:/remote/dir /this/dir/
Run Code Online (Sandbox Code Playgroud)
ssh 客户端和 sshd 服务器都使用协议的第 2 版。
可能是什么问题呢?
[编辑] 我发现http://www.eng.cam.ac.uk/help/jpmg/ssh/authorized_keys_howto.html 指示有时需要“通过使用 -2 标志强制 v2 到 ssh 或 slogin
ssh -2 -i ~/.ssh/my_private_key remotemachine"
Run Code Online (Sandbox Code Playgroud)
目前尚不清楚这是否解决了问题,因为我认为我在错误更改后进行了此更改,但事实是错误已演变为其他内容。当我了解更多信息时,我会更新这个。我当然会尝试在 emacs shell 中运行它的建议 -
事实证明 rsync 无法与具有 .bashrc 文件的远程服务器一起使用?
在本地客户端运行 rsync 时得到:
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(180) [sender=3.0.7]
Run Code Online (Sandbox Code Playgroud)
正如这里建议的那样,删除服务器上的 .bashrc 解决了这个问题。如何在不删除 .bashrc 文件(临时)的情况下解决它?