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

相关推荐
励志师code8 分钟前
Kubernetes 集群节点生命周期管理实战:从扩容、调度管控到证书续期
运维·docker·容器·kubernetes·gpu算力·kubelet
weixin_416667969 分钟前
linux ping命令详解
linux·运维·php
润滑卫士9 分钟前
NAS 1638 油液清洁度等级:检测方法、影响因素与控制策略
运维
硅基手札19 分钟前
【Linux 内核专栏 17】进程间通信 IPC(上)— 管道·信号·System V IPC·mmap·文件锁
linux·运维·服务器·stm32·单片机·mcu
seuzhouchenglong21 分钟前
服务器通过本地电脑连接本地开发板
运维·服务器
AR-26710-25 分钟前
Linux Day21——systemctl操作
linux·运维
木雷坞1 小时前
Docker Compose部署Metabase:应用库隔离与日期筛选看板
运维·docker·容器
讯捷蓝达1 小时前
台山曙光I620-G20服务器RAID5离线数据恢复全过程
运维·服务器
tedcloud1231 小时前
Docker Compose 部署 Immich:手机照片自动备份与常见故障排查
运维·前端·docker·容器·智能手机·开源·流程图
Android系统攻城狮1 小时前
Linux Gstreamer深度解析之gst_audio_ring_buffer_activate调用流程与实战(七十九)
linux·运维·服务器·gstreamer音视频·gstreamer音视频进阶