当前位置: 首页 > 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.mrgr.cn/news/90625.html

相关文章:

  • 关于AURIX在debug时elf文件丢失无法调试
  • 手机用流量怎样设置代理ip?
  • 复制conda虚拟环境的几种方法
  • Spring Boot + ShardingSphere 踩坑记
  • 数据结构结尾
  • 完善sql盲注中的其他函数 dnslog+sqlmap外带数据
  • #渗透测试#批量漏洞挖掘#Crocus系统—Download 文件读取
  • 用于处理元素的全屏显示和退出全屏操作--useFullScreen
  • React进阶之React核心源码解析(一)
  • 【CXX】0 Rust与C ++的互操作利器:CXX库介绍与示例
  • 【Linux】Ubuntu Linux 系统——Python集成开发环境
  • C语言中printf()函数,格式输出符
  • C++ ——基础进阶
  • Spring Boot整合DeepSeek实现AI对话(API调用和本地部署)
  • 2025-2-13-4.5 二分法(基础题)
  • 文字转语音(三)FreeTTS实现
  • macOS部署DeepSeek-r1
  • 使用HX搭建UNI-APP云开发项目(适合新手小白与想学云开发的宝子)
  • 【FastAPI 使用FastAPI和uvicorn来同时运行HTTP和HTTPS的Python应用程序】
  • DeepSeek AI 满血版功能集成到WPS或Microsoft Office中
  • cap1:TensorRT介绍及CUDA环境安装
  • 解决QPixmap报“QPixmap::grabWindow(): Unable to copy pixels from framebuffer“问题
  • 【云安全】云原生- K8S etcd 未授权访问
  • 20250212:sigmastar系列2-获取UUID进行授权
  • Radius协议详解
  • Qt的isVisible ()函数介绍和判断窗口是否在当前界面显示