ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [20201120]cygwin与ssh.txt

[20201120]cygwin与ssh.txt

原创 Linux操作系统 作者:lfree 时间:2020-11-20 10:36:07 0 删除 编辑

[20201120]cygwin与ssh.txt

--//昨天安装cygwin后,今天安装openssh,发现cygwin的ssh无法连接测试服务器,提示:

$ ssh -l root 192.168.100.78
Unable to negotiate with 192.168.100.78 port 22: no matching key exchange method found. Their offer:
diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

--//上网看一个一些链接:
$ cd ~
$ mkdir .ssh
$ cd .ssh
$ touch config
$ chmod 660 config

$ cat config
Host *
KexAlgorithms +diffie-hellman-group1-sha1

--//这样就可以ok了。
--//我使用strace跟踪发现:
$ strace ssh -l root 192.168.100.78 | grep "/etc/"
   15    3207 [main] ssh (6576) mount_info::conv_to_posix_path: /etc/ssh = conv_to_posix_path (D:\tools\cygwin64\etc\ssh)
   20    5562 [main] ssh 2018 win32env_to_cygenv: 0x8000290F0: PWD=/etc/ssh
   91   86350 [main] ssh 2018 open: open(/etc/ssh_config, 0x0)
   12   86362 [main] ssh 2018 normalize_posix_path: src /etc/ssh_config
   13   86375 [main] ssh 2018 normalize_posix_path: /etc/ssh_config = normalize_posix_path (/etc/ssh_config)
   14   86389 [main] ssh 2018 mount_info::conv_to_win32_path: conv_to_win32_path (/etc/ssh_config)
   13   86402 [main] ssh 2018 mount_info::conv_to_win32_path: src_path /etc/ssh_config, dst D:\tools\cygwin64\etc\ssh_config, flags 0x30008, rc 0
   12   86850 [main] ssh 2018 open: -1 = open(/etc/ssh_config, 0x8000), errno 2
  104  138357 [main] ssh 2018 open: open(/etc/ssh_known_hosts, 0x0)
   13  138370 [main] ssh 2018 normalize_posix_path: src /etc/ssh_known_hosts
   13  138383 [main] ssh 2018 normalize_posix_path: /etc/ssh_known_hosts = normalize_posix_path (/etc/ssh_known_hosts)
   16  138399 [main] ssh 2018 mount_info::conv_to_win32_path: conv_to_win32_path (/etc/ssh_known_hosts)
   15  138414 [main] ssh 2018 mount_info::conv_to_win32_path: src_path /etc/ssh_known_hosts, dst D:\tools\cygwin64\etc\ssh_known_hosts, flags 0x30008, rc 0
   17  138943 [main] ssh 2018 open: -1 = open(/etc/ssh_known_hosts, 0x8000), errno 2
  102  139045 [main] ssh 2018 open: open(/etc/ssh_known_hosts2, 0x0)
   16  139061 [main] ssh 2018 normalize_posix_path: src /etc/ssh_known_hosts2
   15  139076 [main] ssh 2018 normalize_posix_path: /etc/ssh_known_hosts2 = normalize_posix_path (/etc/ssh_known_hosts2)
   18  139094 [main] ssh 2018 mount_info::conv_to_win32_path: conv_to_win32_path (/etc/ssh_known_hosts2)
   13  139107 [main] ssh 2018 mount_info::conv_to_win32_path: src_path /etc/ssh_known_hosts2, dst D:\tools\cygwin64\etc\ssh_known_hosts2, flags 0x30008, rc 0
   18  139599 [main] ssh 2018 open: -1 = open(/etc/ssh_known_hosts2, 0x8000), errno 2
Unable to negotiate with 192.168.100.78 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

--//实际上系统配置在/etc/ssh_config.我开始修改D:\tools\cygwin64\etc\defaults\etc\sshd_config文件不对。
--//把文件D:\tools\cygwin64\etc\defaults\etc\sshd_config拷贝到D:\tools\cygwin64\etc\sshd_config,加入
Host *
KexAlgorithms +diffie-hellman-group1-sha1

--//一样可以正常登录。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2735441/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2775
  • 访问量
    6583372