惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
月光博客
月光博客
AI
AI
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CXSECURITY Database RSS Feed - CXSecurity.com
WordPress大学
WordPress大学
GbyAI
GbyAI
L
Lohrmann on Cybersecurity
O
OpenAI News
Schneier on Security
Schneier on Security
P
Palo Alto Networks Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
W
WeLiveSecurity
L
LINUX DO - 最新话题
人人都是产品经理
人人都是产品经理
S
Security Affairs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
Recorded Future
Recorded Future
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
TaoSecurity Blog
TaoSecurity Blog
C
Check Point Blog
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Vercel News
Vercel News
The Hacker News
The Hacker News
Y
Y Combinator Blog
Latest news
Latest news
SecWiki News
SecWiki News
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cisco Blogs
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
L
LINUX DO - 热门话题

Solitudes

开源项目管理工具Plane部署篇 如果你受够了 Jira,可以认真看看这个开源项目管理工具 没有小技巧,帮你快速上手Codex 龙虾哥浏览器操控教程:QClaw让直接用你的浏览器 让AI先出原型再写代码,这是我用过最舒服的前端开发方式 安利两个Claude Code技能 简单记录一下杜甫折腾ipv6踩坑版 用 Tailscale 安全访问龙虾哥 OpenClaw 控制台 丙午马年 · 祝大家身体健康,马到成功,万事如意 出一台hk物理服务器 告别屎山代码!我如何用code-simplifier + code-review将代码审查效率提升200% 2025年终不总结 使用Let's Encrypt 签发的 IP 地址 SSL 证书 MinIO迁移RustFS实战指南一 Tailscale Peer Relay 最新变更解读 Umami 升级提醒:尽快更新以修复 Next.js CVE-2025-66478 漏洞 出一台闲置的物理服务器 k8s免密拉取镜像实践 Z-Image-Turbo,快就完事了
Debian/Ubuntu 默认禁用 SSH RSA 密钥?一篇文章教你彻底解决
ysicing · 2025-11-28 · via Solitudes

使用 copilot.microsoft.com 生成

最近升级了 Gitspace 基础环境版本,导致没法使用 RemoteSSH。

在新版本系统中,不少人发现原本一直使用的 RSA SSH Key 突然无法登录了。原因不是你的服务器出了问题,而是 OpenSSH 在 8.3 版本之后,默认关闭了对 ssh-rsa 的支持。

本文带你快速了解为什么会这样、怎样安全地重新启用 RSA Key 登录,以及需要注意哪些风险和最佳实践。全文简单易懂、一步到位。

RSA 过时协议

OpenSSH 官方从 8.3 起,将 ssh-rsa 标记为过时算法,主要原因是:

  • RSA(尤其是小于 4096 位的)安全性相对较弱
  • 更现代、更高强度的算法例如 ed25519、ecdsa 已经普及
  • 出于安全考虑,服务器端默认不再接受 ssh-rsa 签名

因此,在看到日志类似:

Authentications that can continue: publickey,password
Trying private key: /root/.ssh/id_rsa

之前免密配置了但就是死活登录不上

注意:客户端其实仍然可以使用 RSA,只不过是服务器拒绝了它

大多数情况下,客户端不用配置任何内容,因为 OpenSSH 客户端默认依然支持 RSA
真正需要修改的是服务器,因为服务器默认不接受 ssh-rsa 公钥

当然还有少数情况下客户端也需要配置,我就是改出问题了,客户端也需要配置

重新启用 RSA Key 登录

为了避免修改主配置文件 sshd_config 被升级覆盖,我们使用新版本系统推荐的配置目录 /etc/ssh/sshd_config.d

sudo tee /etc/ssh/sshd_config.d/enable_rsa_keys.conf > /dev/null << EOF
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
EOF

然后重启 ssh 服务

sudo systemctl restart ssh
或
sudo systemctl restart sshd

到这里,服务器已恢复对 RSA Key 的支持。

如果已经执行了这个,还不行就需要配置客户端了

# ~/.ssh/config
Host *
	User root
	ServerAliveInterval 60
	ForwardAgent yes
	TCPKeepAlive no
	ControlMaster auto
	ControlPath ~/.ssh/tmp/connection-%r@%h:%p
	ControlPersist 1h
	Compression yes
	HostkeyAlgorithms +ssh-rsa
	PubkeyAcceptedKeyTypes +ssh-rsa

如果没有 SSH 密钥

ssh-keygen -t rsa -b 4096
或者 默认 -a是16
ssh-keygen -t ed25519 -a 100

其他

只在必要场景下开启 RSA,新的环境更推荐 ed25519