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命令。

相关推荐
huainingning2 小时前
交换机通过ftp下载文件或者传输文件到ftp服务器
运维·服务器·网络
edwarddamon2 小时前
CentOS 7 国内安装 Docker CE(阿里云源)
运维
Championship.23.243 小时前
Linux 3.0 LVDS驱动开发详解
linux·运维·驱动开发·lvds
小池先生3 小时前
Windows服务器如何备份
运维·服务器
风向决定发型丶3 小时前
Shell中的特殊变量
linux·运维·bash
FII工业富联科技服务4 小时前
灯塔工厂用例详解:AR 远程巡检与智能运维闭环落地实践
运维·ar
运维大师4 小时前
【Linux运维极简教程】05-软件包管理
linux·运维·服务器
BerryS3N6 小时前
Cursor+GitOps:AI驱动的自动化运维新范式
运维·人工智能·自动化
刘某的Cloud7 小时前
手工配置nginx的systemd服务
linux·运维·网络·nginx·systemd
kaoa0007 小时前
Linux入门攻坚——82、kvm虚拟化-2
linux·运维·服务器