问题1:控制端发送ssh公钥至被控端失败?被控端主机已存在.ssh目录;但实际进入该主机发现无该目录。
[root@k8s-master01 .ssh]# ssh-copy-id -i /root/.ssh/id_rsa.pub k8s-node01
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@k8s-node01's password:
mkdir: cannot create directory ‘.ssh’: File exists
原因分析:控制端曾发送公钥至被控端主机,需要被控制端删除.ssh;
解决方法:被控制端删除.ssh,重新发送公钥即可。
问题2:控制端发送公钥至被控端成功,但被控端并没有.ssh相关文件?
原因分析:控制端known_hosts未删除被控端的相关fingerprint注册信息。
解决方法:控制端known_hosts删除被控端的相关fingerprint注册信息,重新发送公钥即可。