Ubuntu 18.04.3 是可以通过SSH连接上的

本文详细记录了解决SSH连接Ubuntu服务器遇到的“algorithm negotiation failed”错误的过程。通过调整加密算法配置及重新安装openssh-server服务,最终成功实现远程连接。

查找资料并尝试各种方法,终于成功使用SSH连接上阿里云ECS了

其余的服务器都是CentOS的,唯独这个Ubuntu有那么一点点叛逆,死活连不上

最初的错误是:Too many authentication failures

第一篇:

【Linux】使用 ssh 远程连接Ubuntu 报错“server responded “algorithm negotiation failed”_杨jun坚的博客-优快云博客在阿里云购买了一台服务器,并安装了Ubuntu20.04后,使用ssh 远程登录时,报错"server responded "algorithm negotiation failed”看了网上的解决方法都是在 /etc/ssh/sshd_config 中添加对应一些加密算法,再重启ssh服务。这方法我信了,结果ssh直接挂了,,,结果阿里云自带的远程都没法连接服务器了,幸好有快照可以恢复、挂掉的原因是添加的算法中,不是所有算法都可以支持!!(可能是版本问题导致)使用 sshd -T 可以查看sshttps://blog.youkuaiyun.com/yangjjuan/article/details/122279795第二篇:

SSH Client连接Linux出现~server responded “Algorithm negotiation failes”_xiaozhegaa的博客-优快云博客一、问题描述:近日使用SSH远程连接linux服务器的时候,出现了“server responded ‘Algorithm negotiation failes’”连接不上,查阅了很多资料,才把该问题解决了,特地分享出来给大家 【备注:】如果不会使用SSH Client的读者,建议你们可以去看我写的“如何使用SSH Client”基础入门一篇 http://blog.youkuaiyun.com/xiahttps://blog.youkuaiyun.com/xiaozhegaa/article/details/78832676

我的重新安装了openssh-server

sudo apt remove openssh-server

sudo apt install openssh-server

在这个环节也是折腾了好一会

ssh -Q cipher
ssh -Q mac
ssh -Q kex

echo 'Ciphers' `ssh -Q cipher | paste -d, -s` >> /etc/ssh/sshd_config
echo 'MACs' `ssh -Q mac | paste -d, -s` >> /etc/ssh/sshd_config
echo 'KexAlgorithms' `ssh -Q kex | paste -d, -s` >> /etc/ssh/sshd_config
#sshd_config文件变化的地方不多

#去掉了这两行前面的注释
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key

#在末尾追加了三行,这三行是我通过上面命令写入的,尽量不要照搬照抄
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

sudo service ssh restart

终于成功,这个问题困扰我很久了

这篇文章为后增的,解决了SSH无法连接华为云CentOS 8的问题。

https://blog.youkuaiyun.com/lcc0826/article/details/112347213icon-default.png?t=M4ADhttps://blog.youkuaiyun.com/lcc0826/article/details/112347213 

是的,**你可以在 VSCode 上通过 SSH 连接Ubuntu 系统,并使用终端进行开发和操作**。这是通过 **Remote - SSH 扩展** 实现的,它是微软官方提供的一个扩展,可以让 VSCode 作为远程开发工具连接到 Linux 或其他支持 SSH 的系统。 --- ## ✅ 实现步骤详解: ### 第一步:安装 Remote - SSH 扩展 1. 打开 VSCode。 2. 进入左侧活动栏的 **Extensions(扩展)**。 3. 搜索 `Remote - SSH`。 4. 点击安装。 ### 第二步:确保 Ubuntu 系统已安装并运行 SSH 服务 在你的 Ubuntu 系统上执行以下命令: ```bash sudo apt update sudo apt install openssh-server sudo systemctl enable ssh sudo systemctl start ssh ``` 确保你的 Ubuntu 系统可以通过 SSH 被访问,你可以用其他终端测试一下: ```bash ssh username@your_ubuntu_ip ``` 如果可以登录,说明 SSH 服务正常。 ### 第三步:配置 SSH 连接 在 VSCode 中按下 `Ctrl + Shift + P`(Windows/Linux)或 `Cmd + Shift + P`(Mac),输入并选择: ``` Remote-SSH: Connect to Host... ``` 如果这是第一次使用,VSCode 会提示你创建一个 SSH 配置文件。 选择: ``` Remote-SSH: Add New SSH Host... ``` 然后输入 SSH 命令,例如: ``` ssh username@your_ubuntu_ip ``` VSCode 会提示你选择 SSH 配置文件保存的位置(通常是 `~/.ssh/config`)。 之后你会看到这个主机出现在左侧的 SSH Hosts 列表中。 ### 第四步:连接并使用远程终端 1. 再次点击左下角的绿色远程连接图标(或使用快捷键 `Ctrl + Shift + P`)。 2. 选择 `Remote-SSH: Connect to Host...`。 3. 选择你刚刚添加的 Ubuntu 主机。 4. VSCode 会通过 SSH 连接到你的 Ubuntu 系统。 5. 连接成功后,你可以在 VSCode 中打开远程终端:`Terminal > New Terminal` --- ## 🧠 原理说明 - VSCode 的 Remote - SSH 扩展会在本地 VSCode 与远程服务器之间建立一个 SSH 隧道。 - 它会在远程服务器上自动安装一个轻量级的“VS Code Server”服务。 - 所有的代码编辑、终端操作、调试等都发生在远程服务器上,而本地只负责界面展示。 --- ## ✅ 优势 - 可以在本地编辑远程服务器上的代码。 - 终端就是远程服务器的 shell,可以直接运行命令。 - 支持调试、Git、插件等几乎所有 VSCode 功能。 - 无需在本地安装完整的开发环境。 --- ## ❗ 注意事项 - 确保远程服务器与本地网络通畅。 - 确保远程服务器SSH 服务已启动。 - 可以使用 SSH 密钥认证提高安全性。 - 如果远程服务器没有图形界面,不影响使用 VSCode Remote。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值