赵容用习惯了FlashFXP,遇到几次sftp连接debian12系统提示“SSH错误: 协商密钥交换算法失败”,每次都要去搜索解决,这里记录下来方便直接在博客找,如果有遇到相同问题的朋友也可以参考。
错误信息如上图,我在某个商家的3台VPS都遇到这个问题,估计他们的debian12系统模板问题,不过解决也挺简单,通过修改ssh配置解决。
nano /etc/ssh/sshd_config
加入:
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr HostKeyAlgorithms ssh-ed25519,rsa-sha2-256,rsa-sha2-512,ssh-rsa
保存后重启ssh服务即可:
sudo systemctl restart sshd









![[黑五]vmiss:全场VPS/独立服务器7折起,美国/韩国/日本/香港VPS年付106元起,可选CN2 GIA/AS9929/CMIN2线路-赵容部落](https://www.zrblog.net/wp-content/uploads/2022/05/vmiss.png)
![[黑五]HostDare低至3.5折+双倍内存+双倍流量,洛杉矶VPS年付9.1美元起,可选AMD EPYC,可选CN2 GIA+AS9929+CMIN2线路-赵容部落](https://www.zrblog.net/wp-content/uploads/2016/06/hostdare.png)
![[11.11]搬瓦工全场8.9折优惠码,可选香港/日本/美国/加拿大/荷兰/阿联酋等多机房,大带宽CN2 GIA线路-赵容部落](https://www.zrblog.net/wp-content/uploads/2013/11/bandwagonhost.jpg)