# 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\], c

**URL:** <https://www.shiqidu.com/t/topic/891>\
**Category:** 开发调优\
**Tags:** macOS\
**Created:** [2026 年5 月 16 日 15:30 UTC](https://www.shiqidu.com/t/topic/891 "2026-05-16T15:30:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![Eureka](https://www.shiqidu.com/user_avatar/www.shiqidu.com/eureka/32/5_2.png) [@Eureka](https://www.shiqidu.com/u/Eureka)\
发布日期： [2026 年5 月 16 日 15:30 UTC](https://www.shiqidu.com/t/topic/891/1 "2026-05-16T15:30:01Z")

</div>

如题，换了新电脑之后使用Naivat连接远程数据库报错如下，macOS系统版本、系统openSsh版本、Navicat版本都和原电脑一直的情况下仍旧报错

```auto
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 注释掉的是原配置

```bash
➜ ~ 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`，增加如下配置

```bash
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。
