加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 首次按脚本运行ssh-copy-id回答“是”?

发布时间:2020-12-13 18:00:52 所属栏目:Linux 来源:网络整理
导读:它会第一次询问ssh-copy-id # ssh-copy-id -i .ssh/id_dsa.pub backup@example.comThe authenticity of host 'example.com (xxx.xxx.xxx.xxx)' can't be established.RSA key fingerprint is 39:fb:5e:70:30:33:2b:18:17:e9:4f:2f:91:b5:d2:21.Are you sure
它会第一次询问ssh-copy-id
# ssh-copy-id -i .ssh/id_dsa.pub backup@example.com
The authenticity of host 'example.com (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is 39:fb:5e:70:30:33:2b:18:17:e9:4f:2f:91:b5:d2:21.
Are you sure you want to continue connecting (yes/no)?

是否可以编写脚本,所以脚本会回答是的?

解决方法

如果您的ssh-copy-id不支持StrictHostKeyChecking选项,您可以编写一个执行以下操作的脚本:

>对目标服务器运行ssh-keyscan以获取公钥>将其附加到known_hosts文件>运行ssh-copy-id

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读