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

相关推荐
艾伦_耶格宇1 小时前
【ACP】阿里云云计算高级运维工程师--ACP
运维·阿里云·云计算
一位摩羯座DBA2 小时前
Redhat&Centos挂载镜像
linux·运维·centos
cui_win3 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
风清再凯3 小时前
自动化工具ansible,以及playbook剧本
运维·自动化·ansible
深圳安锐科技有限公司3 小时前
深圳安锐科技发布国内首款4G 索力仪!让斜拉桥索力自动化监测更精准高效
运维·安全·自动化·自动化监测·人工监测·桥梁监测·索力监测
猫头虎3 小时前
猫头虎 AI工具分享:一个网页抓取、结构化数据提取、网页爬取、浏览器自动化操作工具:Hyperbrowser MCP
运维·人工智能·gpt·开源·自动化·文心一言·ai编程
Lois_Luo4 小时前
使用 DigitalPlat 免费搭配 Cloudflare Tunnel 实现飞牛系统、服务及 SSH 内网穿透教程
ssh·内网穿透
cocologin5 小时前
RIP 技术深度解析
运维·网络·网络协议
庸子5 小时前
基于Jenkins和Kubernetes构建DevOps自动化运维管理平台
运维·kubernetes·jenkins
Lpy25695 小时前
Docker Desktop 安装到D盘(包括镜像下载等)+ 汉化
运维·docker·容器