openssh - 当我尝试 ssh 时如何解决“找不到匹配的 mac 错误”
问题描述
以下是我得到的错误:找不到匹配的mac:client hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 server hmac-sha2 -512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
解决方案
在了解基础知识和根本原因之前,我已经为这个问题苦苦挣扎了很长时间。分享经验,以便它可以帮助某人。
我试图 ssh 到目标服务器并收到如下错误
$ ssh -A <someTargetServerNameOrIP>
Unable to negotiate with XX.XX.XX.XX port 1234: no matching MAC found.
Their offer:
hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,
umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
此错误的根本原因是在您的源计算机上,支持的 MAC 不包含来自目标服务器的 MAC。
在您的机器上的命令行中查看此运行
$ ssh -Q mac # output would be something like
hmac-sha1
hmac-sha1-96
hmac-sha2-256
hmac-sha2-512
hmac-md5
hmac-md5-96
umac-64@openssh.com
umac-128@openssh.com
因此,现在为了使用他们选择的服务器不支持的 mac 连接到目标服务器,您必须明确提供目标服务器支持的 mac 之一。例如,我们从错误消息中获取hmac-sha2-512并尝试连接,它将被连接
$ ssh -m hmac-sha2-512 -A <someTargetServerNameOrIP>
问题的另一个变体是密码不匹配,如下所示
$ ssh -A <someTargetServerNameOrIP>
Unable to negotiate with XX.XX.XX.XX port 1234: no matching cipher found.
Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
根本原因是密码不匹配
通过以下方式检查您支持的密码
$ ssh -Q cipher # output would be something like
3des-cbc
aes256-cbc
rijndael-cbc@lysator.liu.se
aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
因此,现在为了使用您的服务器不支持的密码选择连接到目标服务器,您必须明确提供目标服务器支持的密码之一。例如,我们从错误消息中获取 aes128-cbc 并尝试连接,它将被连接
$ ssh -c aes128-cbc -A <someTargetServerNameOrIP>
有关这方面的更多详细信息, 请参见https://diego.assencio.com/?index=688f3a536f63c43566c94f0818d9ecf3
希望这可以帮助某人。
推荐阅读
- swift - 如何使用 UI 测试用例验证 UITableviewCell 标签和 Imageview 数据
- javascript - 可见:假和隐藏:真之间的区别
- javascript - 在反应预输入引导程序中将变量传递给`renderMenuItemChildren`
- ios - Swift Core 蓝牙通讯与 OBD2
- python-3.x - 使用 Python 设置主机名
- python - 如何在叠加图中将 RangetoolLink 与全息视图一起使用
- javascript - 我们是否能够从 HTML 向 android 主屏幕添加图钉?
- mysql - 优化查询 - 1 个数据库中的用户订阅,另一个数据库中的 3 级数据。查找用户订阅的顶层
- python - 如何在 PyQt5 中基于中心而不是左角使用移动命令定位标签
- git - Git rebase when rebaseing master with a feature - 了解变基图