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

相关推荐
SPC的存折18 小时前
6、Docker常用配置
运维·docker·容器
图图玩ai19 小时前
SSH 命令管理工具怎么选?从命令收藏到批量执行一次讲清
linux·nginx·docker·ai·程序员·ssh·可视化·gmssh·批量命令执行
星谐20 小时前
AutoUploadLL:自动化上传工具开发实践
运维·自动化
NineData20 小时前
NineData将亮相2026德国汉诺威工业博览会
运维·数据库·后端
CXH72820 小时前
nginx——https
运维·nginx·https
SPC的存折20 小时前
4、Docker私有仓库
运维·docker·容器
开开心心_Every20 小时前
扫描软件,部分文档文字表格识别功能可免费
运维·服务器·pdf·电脑·excel·3dsmax·houdini
陆伟峰(云固件作者)20 小时前
Linux Mint 22.3:给初学者的第一份 Linux 说明书
linux·运维·服务器
SaN-V20 小时前
MacOS 下 VS Code 中 Codex 通过 SSH 连接远程服务器无法使用的问题排查与解决
服务器·macos·chatgpt·ssh·codex
无忧智库20 小时前
从数据孤岛到全球实时协同:某跨国企业 Data Fabric 供应链数据编织平台全解析(WORD)
运维·fabric