当前位置: 首页 > news >正文

(Windows | Linux)ssh访问服务器报错:no matching key exchange method found

问题现象

ssh user1@192.168.1X.XX
Unable to negotiate with 192.168.1X.XX port 22: no matching key exchange method found. Their offer: gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

OpenSSH in Linux解决方法

方案一:ssh -o选项指定KexAlgorithms和HostKeyAlgorithms

ssh -o KexAlgorithms=+diffie-hellman-group1-sha1 -o HostKeyAlgorithms=+ssh-rsa user1@192.168.1X.XX

注:  -o 'option' Process the option as if it was read from a configuration file.

方案二:配置/etc/ssh/ssh_config客户端配置文件

KexAlgorithms=+diffie-hellman-group1-sha1
HostKeyAlgorithms=+ssh-rsa
MACs=+hmac-sha1

OpenSSH in Windows解决方法

上面的解决方法,方案一在Linux和Windows上都OK但是方案二针对的是Linux下的,很简单~~

那么Windows下安装的OpenSSH呢?存在ssh_config吗?

我们先看看Windows上的OpenSSH安装目录在哪?有没有ssh_config。

C:\Windows\System32\OpenSSH\下有sshd_config_default,却没有ssh_config文件;手动增加,配置后也没有生效。好吧~~去Microsoft官网查查吧!

OpenSSH Server configuration for Windows | Microsoft LearnLearn about the Windows-specific configuration options for OpenSSH Server on Windows Server and Windows.https://learn.microsoft.com/zh-cn/windows-server/administration/OpenSSH/openssh-server-configuration通过上面链接查找,刚好查到,ssh客户端配置文件:%userprofile%\.ssh\config

那么,我们看看%userprofile%\.ssh\目录下都有啥:

dir %userprofile%\.ssh\
 Volume in drive C is Windows
 Volume Serial Number is D46B-XXXX

 Directory of C:\Users\user1\.ssh

2025/02/14  10:33    <DIR>          .
2025/02/14  09:55    <DIR>          ..
2025/02/14  09:55               225 known_hosts
               2 File(s)            311 bytes
               2 Dir(s)  15,802,699,776 bytes free

没有config文件,创建一个即可:

echo KexAlgorithms=+diffie-hellman-group1-sha1 >> %userprofile%\.ssh\config
echo HostKeyAlgorithms=+ssh-rsa >> %userprofile%\.ssh\config
echo MACs=+hmac-sha1 >> %userprofile%\.ssh\config

C:\Users\xiao>ssh user1@192.168.XX.210
Authorized users only. All activity may be monitored and reported.
(user1@192.168.XX.210) 口令:
Last login: Fri Feb 14 09:55:23 2025 from 192.168.XX.70
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
user1@solaris10u11-210:~$

http://www.lryc.cn/news/538891.html

相关文章:

  • Linux(centos)系统安装部署MySQL8.0数据库(GLIBC版本)
  • 有哪些滤波,原理是什么,分别在什么时候用
  • 深入解析与解决 Oracle 报错:ORA-29275 部分多字节字符20250213
  • iOS 上自定义编译 FFmpeg
  • linux-带宽性能压测-全解iperfwgetspeedtest-cli
  • 【前端学习笔记】Webpack
  • Qt——连接MySQL数据库之编译数据库驱动的方法详细总结(各版本大同小异,看这一篇就够了)
  • 【R语言】方差分析
  • 深度学习机器学习:常用激活函数(activation function)详解
  • TCP协议(Transmission Control Protocol)
  • django上传文件
  • Web 后端 请求与响应
  • 【深度解析】图解Deepseek-V3模型架构-混合专家模型(MoE)
  • 全平台搭载旭日5!科沃斯GOAT智能割草机器人全新系列正式开售
  • ORB-SLAM3的源码学习:TwoViewReconstruction通过两幅图像来实现重建
  • 基于单片机ht7038 demo
  • 【DeepSeek三部曲】DeepSeek-R1论文详细解读
  • 【深度学习】计算机视觉(CV)-目标检测-DETR(DEtection TRansformer)—— 基于 Transformer 的端到端目标检测
  • Windows Docker运行Implicit-SVSDF-Planner
  • ELK安装部署同步mysql数据
  • Vision Transformer图像分块嵌入核心技术解析:从数学推导到工业级应用
  • 【产品资料】陀螺匠·企业助手v1.8 产品介绍
  • 深度求索-DeepSeek-R1本地部署指南
  • 代码随想录day12
  • 告别第三方云存储!用File Browser在Windows上自建云盘随时随地访问
  • Ubuntu 下 nginx-1.24.0 源码分析 - NGX_MAX_ALLOC_FROM_POOL
  • PyQt6/PySide6 的 SQL 数据库操作(QtSql)
  • 利用IDEA将Java.class文件反编译为Java文件:原理、实践与深度解析
  • Kafka偏移量管理全攻略:从基础概念到高级操作实战
  • 【R语言】GitHub Copilot安装-待解决