Windows下使用SSH鏈接到舊設備

正好今天遇到一箇舊設備有點問題,須要經過SSH的方式鏈接上去檢查。Windows 10自帶了SSH命令,能夠直接鏈接而沒必要尋求其它工具的支持了。若是看不到圖,請點我
Windows下使用SSH鏈接到舊設備html

結果發現沒法鏈接,顯示協商錯誤。目標機器須要使用Diffie-Hellman密鑰交換協議中group1-sha1的方式。因而加上參數繼續鏈接
Windows下使用SSH鏈接到舊設備
可是繼續遇到錯誤,顯示舊設備只支持3des-cbc的加密方式。只能再加上參數鏈接。
因而整條命令變成了這個:
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc root@192.168.248.216
Windows下使用SSH鏈接到舊設備
結果,仍然有問題。顯示密鑰長度無效。ssh

通過各類資料查找,發現是openssh在7.6和之後的版本中去掉了對小於1024位密鑰的支持。
OpenSSH 7.6/7.6p1 (2017-10-03)
OpenSSH 7.6 was released on 2017-10-03. It is available from the
mirrors listed at https://www.openssh.com/.ide

OpenSSH is a 100% complete SSH protocol 2.0 implementation and
includes sftp client and server support.工具

Once again, we would like to thank the OpenSSH community for their
continued support of the project, especially those who contributed
code or patches, reported bugs, tested snapshots or donated to the
project. More information on donations may be found at:
http://www.openssh.com/donations.htmlui

Potentially-incompatible changes

This release includes a number of changes that may affect existing
configurations:this

  • ssh(1): delete SSH protocol version 1 support, associated
    configuration options and documentation.加密

  • ssh(1)/sshd(8): remove support for the hmac-ripemd160 MAC..net

  • ssh(1)/sshd(8): remove support for the arcfour, blowfish and CAST
    ciphers.3d

  • Refuse RSA keys <1024 bits in length and improve reporting for keys
    that do not meet this requirement.code

  • ssh(1): do not offer CBC ciphers by default.
    https://www.openssh.com/releasenotes.html

檢查一下Windows 10上的SSH版本
ssh -V
Windows下使用SSH鏈接到舊設備
已是7.7了。因此沒法支持舊設備了。

找了個Linux機器,看一下SSH的版本信息。
Windows下使用SSH鏈接到舊設備
因而,順利連上設備。

對於命令中那麼長的參數。其實能夠在配置文件中指定,Windows上的配置文件位於用戶配置文件目錄下.ssh目錄中。默認並無config文件,須要手動建立。寫入如下內容:Host 192.168.248.216KexAlgorithms +diffie-hellman-group1-sha1Ciphers +3des-cbc這樣就能夠直接鏈接設備了,不過對於密鑰長度的支持這個沒法解決。因此對於有老舊設備的環境中也最好保留1臺能夠鏈接的設備以備不時之需。

相關文章
相關標籤/搜索