我将此命令作为 bash 脚本运行:
rsync -avz -e ssh -o StrictHostKeyChecking=no /srv/system/scripts/test.txt server@hidden:/home/server/serverscripts/mounts/digitalocean
这是输出:
# ./rsync
sending incremental file list
rsync: link_stat "/srv/system/scripts/StrictHostKeyChecking=no" failed: No such file or directory (2)
sent 49 bytes received 12 bytes 40.67 bytes/sec
total size is 15 speedup is 0.25
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]
我相信问题在于命令中选项的顺序,但我找不到解决它的方法。测试文件无论如何都会发送,但我相信 StrictHostKeyChecking 不起作用。
答案1
尝试引用您的 ssh 命令:
rsync -avz -e "ssh -o StrictHostKeyChecking=no" /srv/system/scripts/test.txt server@hidden:/home/server/serverscripts/mounts/digitalocean