Ubuntu20.04 openss环境搭建及出现server responded “algorithm negotiation failed“的解决方法

一、安装 ssh server

输入sudo apt get install openssh server

在这里插入图片描述

二、切换到window下登录发现出错

在这里插入图片描述
按照大多数的解决方法,在/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

添加完成后,重启ssh服务(/etc/init.d/ssh restart),出现问题
Restarting ssh (via systemctl): ssh.serviceJob for ssh.service failed because the control process exited with error code.
See “systemctl status ssh.service” and “journalctl -xe” for details.
failed!
在这里插入图片描述
通过查找资料分析,应该是不同版本,使用的内容不一样,
通过使用ssh -Q cipher/ssh -Q macs/ssh -Q KexAlgorithms读取使用版本的选项
在这里插入图片描述
将上面添加到/etc/ssh/sshd_config文件末尾的内容进行修改,将cipher/macs/KexAlgorithms后的内容替换成查询的内容。
在这里插入图片描述
最后添加到/etc/ssh/sshd_config文件末尾的内容为

Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
 
Macs hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,umac-64@openssh.com,umac-128@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com

KexAlgorithms 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,curve25519-sha256,curve25519-sha256@libssh.org,sntrup4591761x25519-sha512@tinyssh.org

重启ssh服务(/etc/init.d/ssh restart)
在这里插入图片描述
成功

三、传输文件验证

回到windows下,使用SSH Secure输入IP地址(在终端模式下使用ifconfig)、用户名 、port(默认22),验证模式为Password,
在这里插入图片描述

登录成功,并能传输文件
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值