gpt4 book ai didi

linux - 在 scp 命令中传递 yes 参数

转载 作者:IT王子 更新时间:2023-10-28 23:53:00 26 4
gpt4 key购买 nike

当我简单地运行这些命令时,我遇到了一个问题。

远程服务器想要通过 yes 将 key 添加到 RSA 文件中,因为第一次连接是通过 scp 建立的。

命令如下

#!/bin/bash

scp -P58222 root@IP:/root/K /N
/usr/bin/expect -c 'expect "\n" { expect "Are you sure you want to continue connecting (yes/no)?" }'
send "yes\r"
expect "$ "
send "exit\r"

实际上我在询问时必须在我的脚本中传递 yes

无法确定主机'ip地址(ip地址)'的真实性。

RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)?

Are you sure you want to continue connecting (yes/no)?

我怎样才能摆脱这个问题?

scp -o  StrictHostKeyChecking=no

它还在问。

最佳答案

scp -o StrictHostKeyChecking=no root@IP:/root/K 

显然,这不是一个非常安全的解决方案。不过,适用于您不关心中间人的一次性拍摄。

关于linux - 在 scp 命令中传递 yes 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29374144/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com