j1*_*om. 162 ssh debian openssh key-authentication ssh-agent
我无法通过 ssh 连接到要求diffie-hellman-group1-sha1密钥交换方法的服务器:
ssh 123.123.123.123
Unable to negotiate with 123.123.123.123 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
Run Code Online (Sandbox Code Playgroud)
如何diffie-hellman-group1-sha1在 Debian 8.0 上启用密钥交换方法?
我曾尝试(如建议在这里),以
将以下行添加到我的 /etc/ssh/ssh_config
KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
Ciphers 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr
Run Code Online (Sandbox Code Playgroud)重新生成密钥
ssh-keygen -A
Run Code Online (Sandbox Code Playgroud)重新启动 ssh
service ssh restart
Run Code Online (Sandbox Code Playgroud)
但仍然得到错误。
Ste*_*itt 275
OpenSSH 网站有一个页面专门讨论诸如此类的遗留问题。它建议在客户端采用以下方法:
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 123.123.123.123
Run Code Online (Sandbox Code Playgroud)
或更永久地,添加
Host 123.123.123.123
KexAlgorithms +diffie-hellman-group1-sha1
Run Code Online (Sandbox Code Playgroud)
到~/.ssh/config。
这将启用客户端上的旧算法,允许它连接到服务器。
小智 39
我尝试了这个解决方案,但我的问题是我有很多(旧)客户端连接到我最近升级的服务器(ubuntu 14 -> ubuntu 16)。
openssh6 -> openssh7 的更改默认禁用了diffie-hellman-group1-sha1密钥交换方法。
阅读完这篇和这篇后,我想出了我需要对/etc/ssh/sshd_config文件做的更改:
#Legacy changes
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +aes128-cbc
Run Code Online (Sandbox Code Playgroud)
但是更广泛的遗留更改集是(取自此处)
#Legacy changes
KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
Ciphers 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr
Run Code Online (Sandbox Code Playgroud)
小智 10
我也面临同样的问题,但通过执行以下命令解决了它。您无需重新启动 SSH 服务器即可完成此操作 -
问题:
ssh test@123.123.123.123
protocol identification string lack carriage return
Unable to negotiate with 123.123.123.123 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
root@shoesdekho#
Run Code Online (Sandbox Code Playgroud)
解决方案:
ssh -o KexAlgorithms=diffie-hellman-group1-sha1 test@123.123.123.123
Run Code Online (Sandbox Code Playgroud)
在其他系统上,我观察到使用上述命令也不起作用。尝试使用命令添加密码。查看完整命令如下 -
root@shoesdekho#ssh -o KexAlgorithms=diffie-hellman-group1-sha1 -o Ciphers=aes256-cbc test@123.123.123.123
protocol identification string lack carriage return
Warning: Permanently added '123.123.123.123' (RSA) to the list of known hosts.
Password:
This computer system is restricted to authorized users.
Unauthorized access attempts will be prosecuted.
If unauthorized, disconnect now.
bookmiday#
Run Code Online (Sandbox Code Playgroud)
小智 5
\xe2\x80\x9c无法与 xxxx 端口 22 协商:未找到匹配的密钥交换方法。他们的报价:diffie-hellman-group1-sha1,diffie-hellman-group14-sha1\xe2\x80\x9d
\nvim ~/.ssh/config 并添加:
\nHost *\n KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x80\x9c 未找到匹配的主机密钥类型。他们的报价: ssh-rsa\xe2\x80\x9d
\nvim ~/.ssh/config 并添加:
\nHost * \n PubkeyAcceptedAlgorithms +ssh-rsa \n HostKeyAlgorithms +ssh-rsa \nRun Code Online (Sandbox Code Playgroud)\n