ssh指定的密钥协商方式以及Ansible的hosts文件修改密钥协商方式

一、首先你要知道用什么加密协商。

复制代码
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
10.10.2.190 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Unable to negotiate with 10.10.2.190 port 22: no matching key exchange method found. Their offer: curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256",
    "unreachable": true
}

这里会告诉你:

Their offer: curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256"

然后你可以通过ssh先进行测试:

复制代码
ssh -l root -o KexAlgorithms=diffie-hellman-group-exchange-sha256 10.10.2.190

-o 后根指定的协商方式

二、修改Ansible特定的hosts协商方式

复制代码
[klin]
10.10.2.190 ansible_ssh_user='root' ansible_ssh_pass='Admin123@pl' ansible_ssh_args='-o KexAlgorithms=diffie-hellman-group-exchange-sha256'

在hosts文件中加上 ansible_ssh_args='-o KexAlgorithms=diffie-hellman-group-exchange-sha256'

此时Ansible的ssh命令等价于上面的ssh命令。

相关推荐
huangyuchi.22 分钟前
【Linux系统】动静态库的制作
linux·运维·服务器·动态库·静态库·库的简单制作
闻不多24 分钟前
用llamaindex搭建GAR遇到400
android·运维·服务器
jim写博客1 小时前
Linux进程概念(四)环境地址变量
linux·运维·服务器
是小崔啊1 小时前
【Jenkins】01 - Jenkins安装
运维·jenkins
Nie_Xun2 小时前
ubuntu网络共享
linux·运维·ubuntu
天上掉下来个程小白2 小时前
Docker-14.项目部署-DockerCompose
运维·docker·微服务·容器
花小璇学linux2 小时前
imx6ull-驱动开发篇22——Linux 时间管理和内核定时器
linux·运维·驱动开发
key_Go4 小时前
7.Ansible自动化之-实施任务控制
python·ansible·numpy
Liang_GaRy5 小时前
心路历程-三个了解敲开linux的大门
linux·运维·服务器
星霜笔记6 小时前
Docker 部署 MariaDB+phpMyAdmin+Nextcloud 完整教程
运维·数据库·docker·容器·mariadb