ssh 登入报错问题解决过程记录

Linux服务器我一直都是用的 ssh 远程管理的,最近遇到ssh不能远程登入问题,把问题和解决过程记录一下。

bash 复制代码
C:\Users\admin>ssh root@192.168.123.252
Unable to negotiate with 192.168.123.252 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

还没到用户密码验证,直接就报错了,错误提示:

no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

先求助下度娘: 基本知道问题了,密匙交换算法不一致,根据错误提示,给出了支持的算法,选一种应该就可以吧。

加上 了 参数后

ssh root@192.168.123.252 -oKexAlgorithms=+diffie-hellman-group-exchange-sha1

又报了新的错误了。no matching host key type found. Their offer: ssh-rsa,ssh-dss

同理 报错里也给出了参数选择,只要找出参数名加上,应该就可以。

继续

ssh root@192.168.123.252 -oKexAlgorithms=+diffie-hellman-group-exchange-sha1 -oHostKeyAlgorithms=+ssh-rsa

又报了新的错误。 no matching MAC found. Their offer: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96

这个百度没找到,查了一下ssh命令帮助找到了。

继续

ssh root@192.168.123.252 -oKexAlgorithms=+diffie-hellman-group-exchange-sha1 -oHostKeyAlgorithms=+ssh-rsa -m hmac-md5

成了,到了输密码状态了。 正确输入密码,也能正常登入了。

但是每次如果都要输这么一大串,挺难受的,看上面解决过程中有提到可以在本地的 config 文件里配置这些参数的。

可以参考一下 ssh config 文件的具体说明。 我根据说明把这几项配置进去后,就正常能用了。

相关推荐
J2虾虾35 分钟前
Docker启动超时,吓得我一身汗
运维·docker·容器
一生只为赢1 小时前
通俗易懂:ARM指令的寻址方式(三)
运维·arm开发·数据结构·嵌入式实时数据库
运维行者_1 小时前
2026 技术升级,OpManager 新增 AI 网络拓扑与带宽预测功能
运维·网络·数据库·人工智能·安全·web安全·自动化
液态不合群2 小时前
Nginx多服务静态资源路径冲突解决方案
运维·nginx
Getgit2 小时前
Linux 下查看 DNS 配置信息的常用命令详解
linux·运维·服务器·面试·maven
数通工程师3 小时前
企业级硬件防火墙基础配置实战:从初始化到规则上线全流程
运维·网络·网络协议·tcp/ip·华为
岁岁种桃花儿3 小时前
详解kubectl get replicaset命令及与kubectl get pods的核心区别
运维·nginx·容器·kubernetes·k8s
捷智算云服务3 小时前
告别运维割裂!捷智算GPU维修中心重新定义“全栈式”维修新标准
运维·服务器·性能优化
青火coding4 小时前
SOFAServerless架构的意义
java·运维·中间件·架构·serverless
橘颂TA4 小时前
【Linux 网络】TCP 拥塞控制与异常处理:从原理到实践的深度剖析
linux·运维·网络·tcp/ip·算法·职场和发展·结构与算法