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

相关推荐
Harm灬小海几秒前
【云计算学习之路】企业常用服务搭建:构建Apache WEB服务器
运维·服务器·学习·云计算·apache
大江东去浪淘尽千古风流人物6 分钟前
【Polaris-VIO】Docker 镜像跨硬件分发的隐藏陷阱:AVX-512、-march=native 与 CPU 指令集解耦边界
运维·docker·容器·slam·vio·avx-512
十子木8 分钟前
SSH 反向端口转发 (Remote Port Forwarding)
运维·ssh
AI云原生11 分钟前
远程控制软件进入协作阶段:ToDesk、向日葵、AnyDesk、RustDesk怎么选?
运维·服务器·网络·windows·docker·云原生·开源软件
测试员周周7 小时前
【Appium 系列】第16节-WebView-H5上下文切换 — 混合应用的自动化难点
运维·开发语言·人工智能·功能测试·appium·自动化·测试用例
在角落发呆10 小时前
Linux转发配置:解锁网络互联的核心密码
linux·运维·网络
裴东青12 小时前
10-实战:RuoYi-Cloud的自动化发布
运维·ci/cd·自动化
哎呦,帅小伙哦12 小时前
Linux 时间:从原子钟到 clock_gettime 的每一面
linux·运维·服务器
sxgzzn12 小时前
新能源场站数智化转型:基于数字孪生与AI的智慧运维管理平台解析
大数据·运维·人工智能
张小姐的猫13 小时前
【Linux】多线程 —— 线程互斥
linux·运维·服务器·c++