SSH之前一直连不上,说密钥交换算法不匹配,一开始懒得弄,发现putty可以正常用。今天有空来搞搞。
方法:
修改sshd的配置文件 /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
修改之后保存,sudo /etc/init.d/ssh restart重启ssh服务。应该就ok。
重启的时候如果遇到:Job for ssh.service failed because the control process exited with error codesee systemctl status ssh.service and journalctl -xe for details. 应该是配置文件修改的时候改出了问题。输入sudo /usr/sbin/sshd -T进行检测,如果是配置文件的问题会直接提醒具体的行和内容,修改好之后再尝试重启就ok了 。