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 文件的具体说明。 我根据说明把这几项配置进去后,就正常能用了。

相关推荐
馨谙35 分钟前
chage -d 0 强制密码修改的完整流程
linux·运维
喵叔哟38 分钟前
7. 从0到上线:.NET 8 + ML.NET LTR 智能类目匹配实战--反馈存储与数据治理:MongoDB 设计与运维
运维·mongodb·.net
爱技术的小伙子42 分钟前
【Linux运维】 Prometheus + Grafana + Alertmanager 监控系统部署指南(CentOS & Ubuntu 通用版)
linux·运维·prometheus
算力魔方AIPC1 小时前
PP-OCRv5 MCP服务器在海光主板的部署与实战
运维·服务器
dyxal1 小时前
内网windows系统机器通过vscode ssh连接内网服务器,无网络导致的一系列无法正常连接问题
服务器·vscode·ssh
Olrookie2 小时前
MySQL运维常用SQL
运维·数据库·sql·mysql·dba
hweiyu002 小时前
Linux运维实战:云原生设计与实施Docker&K8S(视频教程)
linux·运维·云原生
blackorbird2 小时前
使用 Overpass Turbo 查找监控摄像头
运维·服务器·数据库·windows
小白不想白a2 小时前
【shell】每日shell练习(系统用户安全审计/系统日志错误分析)
linux·运维·云原生
SelectDB技术团队3 小时前
Apache Doris 与 ClickHouse:运维与开源闭源对比
运维·clickhouse·apache