Debian 8 jessie, OpenSSH ssh connection server responded Algorithm negotiation failed,opensshresponded


 

安装了debian 8.5 就出问题了.

 

root@debian8:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.5 (jessie)
Release: 8.5
Codename: jessie
root@debian8:~# uname -a
Linux debian8 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux
root@debian8:~#

ssh 连接失败

 

参考了:

http://bbs.chinaunix.net/thread-4160457-2-1.html

这篇文章 还是不成功.

 

"

更新ssh到openssh-6.7p1.tar最新版,然后问题来了,ssh client连不上了,putty可以,SecureCRT 7.1可以 5.1又不行了,查了一下说加密协议不对,可是我不会,请教各位

白天图挂了,手动上字

crt5.1 连提示: 到会话1.1.1.1 的连接失败:
                密钥交换失败。
                没有兼容的加密程序。服务器支持这些加密程序:
                aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-      

                gcm@openssh.com,chacha20-poly1305@openssh.com

ssh client 提示:Server responded"Algorithm negotiation failed"
                 Key exchange with the remote host failed. This can happen for
                 example computer does not support the selected algorthms. 

 

 

-------------------------------------------

 

问题已经解决了,修改ssh的配置文件 /etc/ssh/sshd_config

在配置文件中添加:

Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc

MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

重启sshd服务后,即可正常连接。

ps:导致此问题的原因是ssh升级后,为了安全,默认不在采用原来一些加密算法,我们手工添加进去即可。

 

"




后面继续在 

root@debian8:~# cat /etc/ssh/sshd_config 

中查找.

发现

默认

#PermitRootLogin without-password 不需要密码,改成需要密码

改成
PermitRootLogin yes

就能使用root登录 ,不然root会失败.因为ssh 默认用的root用户 .

如果使用其它用户 则能成功登录 .

或者先用

putty 而不是用 SSH secure shell 去登录 .

也能成功.

 

还有就是在 

/etc/ssh/sshd_config  添加

Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

这个时由于不能复制,很容易写错.

正确步骤:

1,先用putty非root用户 登录, 

2,nano  /etc/ssh/sshd_config 

copy 之前的 Ciphers ...文本..

3,重启ssh服务

root@debian8:~# service ssh restart

4,查看ssh  是否启动

root@debian8:~# ps aux | grep ssh
root 2640 0.0 1.2 95440 6244 ? Ss 00:26 0:01 sshd: root@pts/0
root 5321 0.0 1.3 95440 6520 ? Ss 00:37 0:00 sshd: root@pts/2
root 12265 0.0 1.2 95356 6476 ? Ss 00:45 0:00 sshd: root@pts/1
root 12283 0.0 0.3 12704 1976 ? Ss 00:50 0:00 /usr/lib/openssh/sftp-server
root 12307 0.0 1.0 55184 5428 ? Ss 00:56 0:00 /usr/sbin/sshd -D
root 12310 0.0 0.4 12728 2200 pts/1 S+ 00:56 0:00 grep ssh
root@debian8:~#

如果  /etc/ssh/sshd_config  写错了,ssh则不能启动.

 

5,再看SSH secure shell能否连接.

 

相关内容