我正在使用以下命令进行Rsyncing:
# rsync -arvce ssh /tmp/rsync/file.txt user@domain:/tmp/rsync/
Run Code Online (Sandbox Code Playgroud)
这工作正常,我将不得不在多个地方这样做,所以我想实现该StrictHostKeyChecking选项.
在阅读其他在线示例后,我添加了这样的选项(3个示例):
# rsync -arvce ssh -o 'StrictHostKeychecking no' /tmp/rsync/file.txt user@domain:/tmp/rsync/
# rsync -arvce ssh -o 'StrictHostKeychecking=no' /tmp/rsync/file.txt user@domain:/tmp/rsync/
# rsync -arvce ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/rsync/file.txt user@domain:/tmp/rsync/
Run Code Online (Sandbox Code Playgroud)
我仍然会被提示验证目标服务器的密钥.我理解-o StrictHostKeychecking = no选项让我选择是否在每次打开连接时绕过该步骤.
我做错了吗?
这里'我读过一些关于此的链接:
http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html
http://www.thegeekstuff.com/2010/04/how-to-fix-offending-key-in-sshknown_hosts-file/
http://www.cyberciti.biz/faq/linux-appleosx-howto-disable-ssh-host-key-checking/
cof*_*tor 42
我已经解决了.
这是添加该选项的正确(或最正确)方式:
# rsync -e "ssh -o StrictHostKeyChecking=no" -arvc /tmp/rsync/file.txt user@domain:/tmp/rsync/
Run Code Online (Sandbox Code Playgroud)
通过添加双引号并将ssh置于其中,似乎有一种挑战性的方式来应用该选项.