近期学习ansible api,初次执行的时候,遇到一些认证问题,可能与新使用的deepin默认设置有关。搜索给出的结果基本是修改/etc/ansible/ansible.cfg
报错信息如下:
"msg": "ERROR! Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."
解决方式:
1.修改配置文件
# vi /etc/ssh/sshd_config
PermitRootLogin yes
使用root用户进行操作,要打开允许root用户ssh登录
# vi /etc/ssh/ssh_config
StrictHostKeyChecking no
/etc/init.d/ssh restart
在首次连接服务器时,会弹出公钥确认的提示。这会导致某些自动化任务,由于初次连接服务器而导致自动化任务中断。或者由于 ~/.ssh/known_hosts 文件内容清空,导致自动化任务中断。 SSH 客户端的 StrictHostKeyChecking 配置指令,可以实现当第一次连接服务器时,自动接受新的公钥。只需要修改 /etc/ssh/ssh_config 文件
