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

相关推荐
「QT(C++)开发工程师」2 分钟前
免费在线 Ubuntu/Linux 运行环境
linux·运维·ubuntu
hhhh明6 分钟前
ubuntu22.04 桌面可视化(vncserver+novnc 方式)
linux·运维·服务器
十六年开源服务商10 分钟前
2026网站主题编辑实战指南
运维
ole ' ola16 分钟前
Linux DDR内存使用情况
linux·运维·服务器
CingSyuan17 分钟前
华为/长江计算 国产信创服务器:基于 BMC 远程 KVM 安装操作系统
运维·服务器·kylin
Kingairy25 分钟前
Linux 机器信任关系
linux·运维·服务器
齐齐大魔王40 分钟前
OpenSSL 原理
运维·网络·nginx·ssh·ssl
流浪0011 小时前
Linux系统篇(一):从零入门操作系统:冯诺依曼体系到进程的完整理解
linux·运维·服务器
STDD1 小时前
Node-RED 自托管部署指南:打造可视化 IoT 自动化平台
运维·物联网·自动化
hj2862511 小时前
Linux学习方法论 + 系统安全加固与性能优化 完整版笔记(含案例)
运维