缘由:ssh
在执行scp id_rsa.pub root@hostname:/root/.ssh这一步时,没在本机的/root/.ssh下生成known_hosts文件。spa
解决方案:ci
vi /etc/ssh/ssh_configget
最后有两行是it
StrictHostKeyChecking norsa
UserKnownHostsFile /dev/nullhosts
把这两行注释掉并保存文件注释
再次执行scp id_rsa.pub root@host141:/root/.sshtab
出现提示文件
The authenticity of host 'host141 (172.20.0.141)' can't be established.
RSA key fingerprint is a0:09:89:d2:3b:aa:91:60:59:7f:7f:bc:03:31:b0:09.
Are you sure you want to continue connecting (yes/no)?
输入yes后,则可看到在/root/.ssh目录下生成了known_hosts文件:
[root@SamuluIndex .ssh]# ls
id_rsa id_rsa.pub known_hosts