aws 的 ubuntu 机器, 怎么才能实现直接 root 密码登录

56 天前
 rekulas

普通 ubuntu 密码登录很简单 允许 password 和 root 就行了, 以前的 aws 机器也可以这样设置就直接 root 密码登录,但是现在的 ubuntu 怎么设置都不行,登录时始终提示 Permission denied (publickey)需要证书

查看.ssh 下针对 root 直接拒绝命令 已删除

询问 deepseek 方案无效未解决

把 sshd config 的 PubkeyAuthentication 改为 no,root 登录提示输入密码了,但是始终过不了验证,已经再三确认 root 密码正确

查看 pam 设置未发现异常

人麻了

1212 次点击
所在节点    Linux
15 条回复
liuhaitaoSB
56 天前
改用 key 吧. 相对更安全点.
siweipancc
56 天前
囧你把证书关了或者删了看看,结局可能是重置系统。
我试过,随缘的,有些可以,有些不可以。
rekulas
55 天前
@siweipancc 见题 试过关闭 密码也过不了 奇葩..
mark2025
55 天前
# /etc/ssh/sshd_config.d/90-custom.conf
PermitRootLogin yes
PubkeyAuthentication yes
# AllowUsers root dba
PasswordAuthentication yes
qfdk
55 天前
主要是 permitRootLogin 要 yes. 然后允许密码登陆 记得最后要重启 sshd 服务
Echiduna
55 天前
@qfdk 提到的,在线 manpage:
https://www.mankier.com/5/sshd_config#PermitRootLogin

一般密码登不上 root 都是因为这个默认设置为 prohibit-root 吧
rekulas
55 天前
PermitRootLogin
PasswordAuthentication

见题 这些基本设置早就改过了, 没效果
感觉是 aws 还改了某个系统设置 但我不清楚是什么
siweipancc
55 天前
@rekulas 我试过,一半一半的机子可以,但我不远程开发,用 ec2 用户目录权限也更稳一点,
qfdk
55 天前
@rekulas #7 那机器扔出来 给人瞅一眼就是
daimaosix
55 天前
开 ssh ,让我上去看看
rekulas
54 天前
@daimaosix 给个邮箱
longbow0
54 天前
看看是否需要修改 ~/.ssh/authorized_keys
参考 https://tecadmin.net/how-to-enable-ssh-as-root-on-aws-ubuntu-instance/
rekulas
54 天前
@longbow0 不是这个 这个早就移除过了
Kaiv2
53 天前
rg 下 /etc/ssh/sshd_config 和 /etc/ssh/sshd_config.d/
目录下面的配置可能遗漏了,云厂商的镜像会有一些自己的默认配置
rekulas
53 天前
@Kaiv2 sshd_config.d/下确实还有个 PasswordAuthentication
改为 yes 重启 root 密码登录仍然报 Permission denied 更换过多次 root 密码没成功

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://ex.noerr.eu.org/t/1137107

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX