![]()

При попытке зайти на сервер с помощью Putty получил ошибку:
Disconnected: Server protocol violation: unexpected
SSH2_MSG_UNIMPLEMENTED packet

Проблема в алгоритме обмена ключами — Key Echange Algorithm.
Вариант 1
Заходим в Putty: Connection > SSH > Kex.

Выделяем алгоритм «Diffie-Hellman group 14», выделяем и перемещаем вверх кнопкой Up.

После этого подключение заработает.
Вариант 2
Правим на сервере sshd_conf, указываем:
KexAlgorithms diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
По умолчанию поддерживаются:
- curve25519-sha256
- curve25519-sha256@libssh.org
- diffie-hellman-group1-sha1
- diffie-hellman-group14-sha1
- diffie-hellman-group14-sha256
- diffie-hellman-group16-sha512
- diffie-hellman-group18-sha512
- diffie-hellman-group-exchange-sha1
- diffie-hellman-group-exchange-sha256
- ecdh-sha2-nistp256
- ecdh-sha2-nistp384
- ecdh-sha2-nistp521
Чтобы всё заработало я просто выпилил все алгоритмы, в которых есть «exchange».

На днях занимался переустановкой операционной системы на одном из рабочих компьютеров. Поставил последнюю версию Fedora и столкнулся с тем, что при попытке подключиться к нему с рабочей станции на Windows по SSH выдается ошибка в Putty с текстом: «Disconnected: Server protocol violation: unexpected ssh2 msg unimplemented packet». Что примечательно, с другого ПК под Linux с помощью штатного клиента к этому компьютеру подцепляюсь без проблем. На форумах главный совет в этом случае — обновить версию клиента. Не помогло! Оказалось всё дело в кексе!
Виновником появления ошибки стал Kex — Key Echange Algorithm — алгоритм обмена ключами. В целях повышения безопасности он был изменён. Теперь нам нужно внести соответствующие изменения в параметры Putty.
Открываем раздел Connection -> SSH -> Kex.

Далее нужно в списке выбора алгоритма выбрать строчку Diffie-Hellman group 14, а затем, с помощью кнопки «Up» поднять её вверх, до первого пункта. После этого ошибка ssh2 msg unimplemented packetсоединение должна исчезнуть и подключение пройдёт без проблем.
- lkubler
- Joined:
- 2015-02-18
- Posts:
- 8
- Location:
- Wisconsin
2020-09-29 22:53
Hi,
I have been using WinSCP in a script to download files each morning for a number of years, has worked great. Until this weekend when the company on the server side upgraded their server and after making the necessary changes I get a Disconnected: Server protocol violation: unexpected SSH2_MSG_UNIMPLEMENTED packet response when trying to perform the $session.Open($sessionOptions) line in my PowerShell script.
Doing my research I find that this error seems related to the Key Exchange Algorithm but I can’t find anything on how to adjust this algorithm in code.
I reached out to the company we are working with and they informed me that the new server uses the ssh-rsa key, 2048-bit and they provided me with the fingerprint.
So I replaced this fingerprint in my script file:
$sessionOptions.SshHostKeyFingerprint = «ssh-dss 2048 <thekey>»
With:
$sessionOptions.SshHostKeyFingerprint = «ssh-rsa 2048 <newkey>»
I entered the new host name and password they provided. Username remained the same.
Note that the host name, username and password combination all word in a competing FTP application.
So what am I missing? I also ran the WinSCP console and receive the same error message.
Any thoughts?
Thanks in advance!
Reply with quote
-
martin◆
Site Admin -
- Joined:
- 2002-12-10
- Posts:
- 38,408
- Location:
- Prague, Czechia
2020-10-02
Please attach a full session log file showing the problem (using the latest version of WinSCP).
To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
Reply with quote
Please answer the following
If it is a terminal issue then please go through wiki
https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH
«OpenSSH for Windows» version
`OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.4
Server OperatingSystem
Version 6.2 (Build 9200)
Windows 2012 server
Client OperatingSystem
Version 6.2 (Build 9200)
Windows 2012 server
What is failing
sftp with putty is getting SSH2_MSG_UNIMPLEMENTED error
PUTTY output:
Looking up host «localhost»
Connecting to 127.0.0.1 port 22
Server version: SSH-2.0-OpenSSH_for_Windows_7.7
Using SSH protocol version 2
We claim version: SSH-2.0-PuTTY_Release_0.63
Doing Diffie-Hellman group exchange
Disconnected: Server protocol violation: unexpected SSH2_MSG_UNIMPLEMENTED packet
Fatal: Disconnected: Server protocol violation: unexpected SSH2_MSG_UNIMPLEMENTED packet
Expected output
login would work
Actual output
Fatal: Disconnected: Server protocol violation: unexpected SSH2_MSG_UNIMPLEMENTED packet
SSHD log wasn’t available unfortunenlty