V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
Earthman
V2EX  ›  Linux

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

  •  
  •   Earthman · 4 天前 · 853 次点击

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

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

    例如,当前是 root 用户:

    login <user> #终端挂掉

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

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

    8 条回复    2025-12-03 12:27:48 +08:00
    wu67
        1
    wu67  
       4 天前
    我记得是一开始是 admin 登进去, sudo -s 切 root. 用完 exit 回车 返回 admin. 再 exit 回车 断开 ssh 链接.
    nlzy
        2
    nlzy  
       4 天前   ❤️ 3
    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
        3
    chinni  
       4 天前
    machinectl shell <user>@
    Earthman
        4
    Earthman  
    OP
       4 天前
    以前查过 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
        5
    Earthman  
    OP
       4 天前
    找到了更多信息

    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.
    iamwin
        7
    iamwin  
       4 天前
    su username 不行吗?从来没遇到过你这种情况
    Earthman
        8
    Earthman  
    OP
       3 天前
    @iamwin su 可以,但是传统的 login 不能以传统的方式用了
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   865 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:25 · PVG 04:25 · LAX 12:25 · JFK 15:25
    ♥ Do have faith in what you're doing.