如题,换了新电脑之后使用Naivat连接远程数据库报错如下,macOS系统版本、系统openSsh版本、Navicat版本都和原电脑一直的情况下仍旧报错
Navicat连接ssh报错 kex error : no match for method kex algos: server [diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1], client [ecdh-sha2-nistp256] (-1)
两种解决办法
方法一
修改 cat /etc/ssh/crypto.conf文件如下,注意 Ciphers、KexAlgorithms 注释掉的是原配置
➜ ~ cat /etc/ssh/crypto.conf
# Default algorithms favoring higher-performance FIPS algorithms
# in most cases.
#
# To configure these SSH algorithms, run the following command:
#
# sudo ln -fs crypto/apple.conf /etc/ssh/crypto.conf
#
# Ciphers ^aes128-gcm@openssh.com,aes256-gcm@openssh.com
Ciphers ^aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes256-ctr,aes128-ctr
# KexAlgorithms ^ecdh-sha2-nistp256
KexAlgorithms ^ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
MACs ^hmac-sha2-256-etm@openssh.com,hmac-sha2-256
很多人用这个方法解决了问题,但是我的Navicat客户端似乎有点任性,它不读取这个配置,所以这个方法对我没用,最终我使用了下面的方法解决问题
方法二
修改 ~/.ssh/config,增加如下配置
Host 123.123.123.123 # 你的服务器Ip
HostName 123.123.123.123 # 你的服务器Ip
KexAlgorithms +diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256
Ciphers +aes256-ctr,aes128-ctr
PubkeyAcceptedKeyTypes +ssh-rsa
虽然 Navicat 不读系统的 crypto.conf,但作为标准的 SSH 客户端,它在建立 SSH 连接时,普遍会去读取你用户家目录下的个人配置文件 ~/.ssh/config。