当我尝试 ssh 时如何解析 'no matching mac found error'
How to resolve 'no matching mac found error' when I try to ssh
以下是我收到的错误:
未找到匹配的 mac:客户端 hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 服务器 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
您收到此错误是因为客户端和服务器未能就消息验证码的哈希算法达成一致。
更多信息在这里:
https://blog.tinned-software.net/debug-ssh-connection-issue-in-key-exchange/
在了解基础知识和根本原因之前,我已经为这个问题苦苦挣扎了很长时间。分享经验,以帮助他人。
我试图通过 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 不包含来自目标服务器的 MAC。
在 machine
的命令行中查看此 运行
$ 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
希望这对某人有所帮助。
最新的 putty 客户端解决了这个问题。
in centOS/RHEL 7 服务器尝试通过 TMA 脉冲安全工具访问服务器并在 /var/log/secure
上出现以下错误
[root@rhellinuxserver ~]# cat /var/log/secure| grep -iE "no matching"
Aug 24 07:02:07 rhellinuxserver sshd[29958]: Unable to negotiate with 172.21.112.111 port 16899: no matching MAC found. Their offer: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com [preauth]
Aug 24 07:15:24 rhellinuxserver sshd[30702]: Unable to negotiate with 172.21.112.111 port 33541: no matching MAC found. Their offer: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com [preauth]
要解决此问题,请按如下所述编辑 sshd_config 文件
# cat -n /etc/ssh/sshd_config | grep -i MAcs
找到直线
MACs 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
替换为
MACs hmac-sha1,hmac-sha1-96,hmac-md5,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
这将添加以下额外的 MAC 算法。
hmac-sha1,hmac-sha1-96,hmac-md5,hmac-ripemd160
立即重启 SSHD 服务
systemctl restart sshd
现在可以访问服务器,在 /var/log/secure 日志文件中找到成功结果。
cat /var/log/secure| grep -i Accepted
Aug 24 07:18:24 rhellinuxserver sshd[548]: Accepted password for username from 172.21.112.111 port 53776 ssh2
以下是我收到的错误: 未找到匹配的 mac:客户端 hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 服务器 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
您收到此错误是因为客户端和服务器未能就消息验证码的哈希算法达成一致。
更多信息在这里: https://blog.tinned-software.net/debug-ssh-connection-issue-in-key-exchange/
在了解基础知识和根本原因之前,我已经为这个问题苦苦挣扎了很长时间。分享经验,以帮助他人。
我试图通过 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 不包含来自目标服务器的 MAC。
在 machine
的命令行中查看此 运行$ 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
希望这对某人有所帮助。
最新的 putty 客户端解决了这个问题。
in centOS/RHEL 7 服务器尝试通过 TMA 脉冲安全工具访问服务器并在 /var/log/secure
上出现以下错误[root@rhellinuxserver ~]# cat /var/log/secure| grep -iE "no matching" Aug 24 07:02:07 rhellinuxserver sshd[29958]: Unable to negotiate with 172.21.112.111 port 16899: no matching MAC found. Their offer: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com [preauth] Aug 24 07:15:24 rhellinuxserver sshd[30702]: Unable to negotiate with 172.21.112.111 port 33541: no matching MAC found. Their offer: hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com [preauth]
要解决此问题,请按如下所述编辑 sshd_config 文件
# cat -n /etc/ssh/sshd_config | grep -i MAcs
找到直线
MACs 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
替换为
MACs hmac-sha1,hmac-sha1-96,hmac-md5,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
这将添加以下额外的 MAC 算法。
hmac-sha1,hmac-sha1-96,hmac-md5,hmac-ripemd160
立即重启 SSHD 服务
systemctl restart sshd
现在可以访问服务器,在 /var/log/secure 日志文件中找到成功结果。
cat /var/log/secure| grep -i Accepted Aug 24 07:18:24 rhellinuxserver sshd[548]: Accepted password for username from 172.21.112.111 port 53776 ssh2