[求助]debian 13 trixie 无法从 root 用户 login 到普通用户

2025 年 12 月 2 日
 Earthman

debian 13 trixie 新安装系统,当前用户为 root 的情况下无法 login 到普通用户,终端会直接断开,甚至到不了输入密码这一步。ssh 的情况下会断开连接 journalctl -xe 也看不什么有用到信息。

未登录的情况下,可以直接登录为普通用户。在 ubuntu noble 系统下就没这问题。

例如,当前是 root 用户:

login <user> #终端挂掉

su --login <user> #不要求密码直接切换

sudo -i -u <user> #不要求密码直接切换

1466 次点击
所在节点    Linux
8 条回复
wu67
2025 年 12 月 2 日
我记得是一开始是 admin 登进去, sudo -s 切 root. 用完 exit 回车 返回 admin. 再 exit 回车 断开 ssh 链接.
nlzy
2025 年 12 月 2 日
Debian 13 把 /usr/bin/login 的实现从 shadow-utils 换成 util-linux 了,后者的手册里有一句话:

If one uses the command login, then the surrounding shell gets killed by vhangup(2) because it’s no longer the true owner of the tty. This can be avoided by using `exec login` in a top-level shell or xterm.
chinni
2025 年 12 月 2 日
machinectl shell <user>@
Earthman
2025 年 12 月 3 日
以前查过 release notes ,没写到这点。搜索也不易找到。
用这样的关键词才找到一点 "debian 13 login shadow-utils util-linux"
结果有条 Debian Trixie: Nested Logins Always Failing
https://lists.debian.org/debian-user/2025/10/msg00183.html

测试过了,没法登录到其他用户,这么重要的 breaking change 居然没有记录
Earthman
2025 年 12 月 3 日
找到了更多信息

A recursive login, as used to be possible in the good old days, no longer works; for most purposes [su]( https://manpages.ubuntu.com/manpages/plucky/man1/su.1.html)
is a satisfactory substitute. Indeed, for security reasons, login does a [vhangup]( https://manpages.ubuntu.com/manpages/plucky/man2/vhangup.2.html) system call to remove
any possible listening processes on the tty. This is to avoid password sniffing. If one uses the command
login, then the surrounding shell gets killed by [vhangup]( https://manpages.ubuntu.com/manpages/plucky/man2/vhangup.2.html) because it’s no longer the true owner of the
tty. This can be avoided by using exec login in a top-level shell or xterm.
Earthman
2025 年 12 月 3 日
iamwin
2025 年 12 月 3 日
su username 不行吗?从来没遇到过你这种情况
Earthman
2025 年 12 月 3 日
@iamwin su 可以,但是传统的 login 不能以传统的方式用了

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

https://www.v2ex.com/t/1176425

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

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

© 2021 V2EX