Debian12指定/bin/nologin失败 作者: 毕世平 时间: 2025-09-05 分类: 默认分类 前言:在升级到`Debian12`系统后,当创建普通用户并指定其`SHELL`为`/bin/nologin`时,系统会返回报错。 本文主要介绍在`Debian12`系统下指定普通用户`SHELL`新命令。 ## 相关命令操作如下 root@important-tool-4:~# cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" root@important-tool-4:~# useradd -s /bin/nologin username useradd: Warning: missing or non-executable shell '/bin/nologin' //会有这样的报错 查询`Google Gemini`后得知: > 在 Debian 12 上,/bin/nologin 这个路径确实不存在。在许多现代的 Linux 发行版中,包括 Debian 12,/bin 和 /sbin 目录的内容已经合并到了 /usr/bin 和 /usr/sbin 中。这是一个名为“/usr merge”的系统架构变化。因此,nologin 的路径已经从 /bin/nologin 或 /sbin/nologin 变成了 /usr/sbin/nologin。 # 创建用户username,指定SHELL为/usr/sbin/nologin useradd -s /usr/sbin/nologin username 标签: none