# 超级用户

超级用户是计算机系统上的一种特殊账户或进程，不受施加于其他普通用户的常规访问限制的约束，可以执行最要害、影响最深远的系统管理<sup>[1](https://pages.cs.wisc.edu/~remzi/OSTEP/security-access.pdf)</sup>。在类 Unix 系统上，超级用户是用户 ID 为 0 的账户，通常命名为 root；在 Windows 上，与之相当的权力属于 Administrators 组的成员，通过提权来行使。这个术语既指账户本身，也指以该身份运行的任何进程。

| 关键事实 | 详情 |
|---|---|
| 定义 | 一种权限远超其他任何用户的特殊用户，用于执行最要害的系统管理<sup>[1](https://pages.cs.wisc.edu/~remzi/OSTEP/security-access.pdf)</sup> |
| Unix 机制 | 在 Linux 上，超级用户是 /etc/passwd 中 UID 为 0 的条目，但有效 UID 为 0 的进程只能获得未被能力边界集（capability bounding set）屏蔽的那些能力，因此 root 的权威并非无条件<sup>[2](https://docstore.mik.ua/orelly/other/Docs/oreilly/other2/puis3rd/0596003234_puis3-chp-5-sect-2.html)</sup><sup> • </sup><sup>[20](https://man7.org/linux/man-pages/man7/capabilities.7.html)</sup> |
| Unix 上的提权 | setuid 可执行文件是提升进程权限的一种方式；sudo 通常结合按命令制定的策略使用这一机制<sup>[3](https://unix.stackexchange.com/questions/267153/what-exactly-differentiates-the-root-user-from-every-other-user)</sup><sup> • </sup><sup>[4](https://www.sudo.ws/docs/man/sudo.man/)</sup> |
| Windows 模型 | UAC 为管理员生成两个令牌；除非用户同意或提供凭据以获取完整的管理员令牌，否则进程以标准令牌运行<sup>[5](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)</sup> |
| 遏制 | Linux 将 root 的权威拆分为约四十种可分别授予的能力，而 SELinux 等强制控制对 root 依然适用<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup> |
| 指导原则 | 最小权限（萨尔策与施罗德，1975）：每个程序和每个用户都应使用完成工作所需的最小权限集<sup>[8](https://www.cs.virginia.edu/~evans/cs551/saltzer/)</sup> |

## 定义与核心概念

许多操作系统都定义一个特殊用户，通常称为超级用户或 root 用户，其用途是允许执行最要害、影响最深远的系统管理<sup>[1](https://pages.cs.wisc.edu/~remzi/OSTEP/security-access.pdf)</sup>。这些名称彼此相关但并不等同。**超级用户**是通用角色；**root** 是持有该角色的约定俗成的 Unix 账户，以 UID 0 而非名称来识别；**管理员**则是 Windows 对 Administrators 组成员的称呼，其权力由[用户账户控制](https://www.edgepedia.org/zh/user-account-control)（UAC）居中调节，而非无条件授予。

root 账户不仅仅是供人登录使用的账户。它也是操作系统自身用来完成基本功能的身份，例如让用户登录和登出、记录记账信息、管理输入/输出设备<sup>[2](https://docstore.mik.ua/orelly/other/Docs/oreilly/other2/puis3rd/0596003234_puis3-chp-5-sect-2.html)</sup>。

## 在类 Unix 系统上的运作方式

**UID 0 解锁了什么。** 以 UID 0 运行的进程固然获得广泛权限，但内核可以通过能力边界集和其他安全控制来限制 root 的权威<sup>[20](https://man7.org/linux/man-pages/man7/capabilities.7.html)</sup>。root 通常可以读写文件、更改文件所有权、杀死进程、绑定网络端口<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup>。即便在 UID 0 下仍有一些限制：只读文件系统保持只读，SELinux 等强制访问控制同样适用于 root<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup>。较早的文献将 UID 0 描述为“不受安全检查”地运行<sup>[2](https://docstore.mik.ua/orelly/other/Docs/oreilly/other2/puis3rd/0596003234_puis3-chp-5-sect-2.html)</sup>；更精确的说法是：自主检查被跳过，而只读挂载和强制控制仍然具有约束力。

**提权。** setuid 可执行文件是提升进程权限的一种方式；还存在其他授予权限的机制<sup>[3](https://unix.stackexchange.com/questions/267153/what-exactly-differentiates-the-root-user-from-every-other-user)</sup>。setuid 程序是访问矩阵中的一次域转移：进程从调用用户所在的行移动到 root 所在的行，如果程序未能检查调用者实际有权做什么，它就变成了一个“混淆代理”<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup>。

**su 与 sudo。** 较老的工具 su 在用目标账户的密码通过认证后，以另一用户的身份启动一个 shell，这鼓励了长期存活的 root shell。Sudo 约于 1980 年由鲍勃·科格肖和克利夫·斯宾塞在纽约州立大学布法罗分校（SUNY/Buffalo）创造，目的是避免停留在 root shell 中的风险；他们的巧妙做法是将 setuid() 和 execvp() 两个系统调用结合起来，以超级用户身份运行单条命令而不改变 shell 的用户 ID<sup>[9](https://hackaday.com/2014/05/28/interview-inventing-the-unix-sudo-command/)</sup>。更新版本于 1985 年 12 月发布到 net.sources 这个 [Usenet 新闻组](https://www.edgepedia.org/zh/usenet-newsgroup)，该名称是“superuser-do”的缩写<sup>[9](https://hackaday.com/2014/05/28/interview-inventing-the-unix-sudo-command/)</sup>。

Sudo 让获授权的用户按照安全策略的规定，以超级用户或另一用户的身份运行命令，并且它使用调用者的真实用户 ID（而非有效用户 ID）来查询该策略<sup>[4](https://www.sudo.ws/docs/man/sudo.man/)</sup>。与 su 不同，当 sudoers 要求认证时，它验证的是调用者的凭据，而不是目标用户或 root 的凭据，不过 rootpw、targetpw 和 runaspw 标志可以改变这一点<sup>[10](https://www.sudo.ws/docs/man/sudoers.man/)</sup>。sudoers 策略默认的密码提示超时为 5 分钟，之后用户必须重新认证<sup>[4](https://www.sudo.ws/docs/man/sudo.man/)</sup>。从机制上说，sudo 本身必须由 uid 0 拥有并设置 setuid 位；否则它会拒绝运行<sup>[11](https://man7.org/linux/man-pages/man8/sudo.8.html)</sup>。一个相关工具 super 允许指定用户以 root 身份或按命令设定的 uid/gid 执行脚本，其本意是作为将脚本设为 setuid root 的安全替代方案<sup>[12](https://manpages.debian.org/bookworm/super/super.1.en.html)</sup>。

**Polkit。** polkit 包包含 pkexec，这是一个 setuid-root 程序，Qualys 称其在每个主流 Linux 发行版上都默认安装<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup>。该程序后来成为一起著名提权漏洞的载体，详见下文。

## Windows、macOS 与移动平台

**用户账户控制。** 当管理员在启用 UAC 的情况下登录 Windows 时，系统会创建两个独立的访问令牌：一个移除了管理权限和 SID 的标准用户访问令牌，以及一个完整的管理员访问令牌<sup>[5](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)</sup>。Explorer.exe 以标准令牌运行，而由于它是用户发起的进程的父进程，所有应用程序都以标准用户身份运行，除非用户提供同意或凭据以批准使用完整的管理员令牌<sup>[5](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)</sup>。默认的提权组件是：标准用户看到凭据提示，处于管理员批准模式的管理员看到同意提示<sup>[5](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)</sup>。微软建议将主用户账户作为标准用户运行，以最大限度地提高安全性<sup>[5](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)</sup>。

**Android。** 与任何基于 [Linux 内核](https://www.edgepedia.org/zh/linux-kernel)的系统一样，Android 有一个 root 用户（UID 0），但在大多数设置下，设备所有者无法以 root 身份执行操作。“已 root”的 Android 是一种确实允许所有者以 root 身份执行操作的设置<sup>[3](https://unix.stackexchange.com/questions/267153/what-exactly-differentiates-the-root-user-from-every-other-user)</sup>。

## 为什么不受限制的超级用户权力是一种风险

O'Reilly 的《UNIX 权威工具》（*UNIX Power Tools*）一书指出，超级用户是 Unix 的主要安全弱点，因为对由 root 运行的程序来说，几乎所有安全限制都被绕过了<sup>[2](https://docstore.mik.ua/orelly/other/Docs/oreilly/other2/puis3rd/0596003234_puis3-chp-5-sect-2.html)</sup>。由于获得超级用户权限使人几乎可以对系统做任何事情，大多数闯入 Unix 系统的攻击者都试图成为超级用户<sup>[2](https://docstore.mik.ua/orelly/other/Docs/oreilly/other2/puis3rd/0596003234_puis3-chp-5-sect-2.html)</sup>。

setuid 程序集中了这一风险。一项针对 Linux 上 setuid-to-root 二进制文件的研究聚焦于 Debian 和 Ubuntu 发行版中部署最广的 28 个 setuid 二进制文件<sup>[13](https://dl.acm.org/doi/10.1145/2592798.2592811)</sup>。2022 年 1 月 25 日，安全公司 Qualys 披露了 PwnKit，这是 polkit 包中 setuid-root 程序 pkexec 的一个漏洞，自 2009 年 5 月起就存在，它让任何本地用户都能在 Ubuntu、Debian、Fedora 和 [CentOS](https://www.edgepedia.org/zh/centos) 的默认安装上以 root 身份运行代码<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup>。

Sudo 本身也出现过策略绕过漏洞。CVE-2026-82474 涉及 1.9.17p2 及之前的 sudo，在基于 ptrace 的拦截模式下，它未能对 execveat 系统调用应用拦截策略检查，使获许可的用户可以通过 execveat 或 fexecve 执行被拒绝的程序，从而绕过策略执行和日志记录<sup>[14](https://nvd.nist.gov/vuln/detail/cve-2026-82474)</sup>。Ubuntu 的公告 USN-8803-1 描述了同一类故障，由王冠男、刘展鹏和李冠成发现<sup>[15](https://ubuntu.com/security/notices/USN-8803-1)</sup>；USN-8895-1 则记录了当时间戳省略末尾时区标识时对 NOTBEFORE 和 NOTAFTER 时间限制的错误处理<sup>[16](https://ubuntu.com/security/notices/USN-8895-1)</sup>。微软自家的 Windows 版 sudo 也带有相关警示：在其 disableInput 和 normal 配置下，恶意进程可能试图通过未提权的 sudo.exe 与已提权的 sudo.exe 之间的连接来驱动提权进程，因此建议使用默认的 forceNewWindow 配置<sup>[17](https://learn.microsoft.com/en-us/windows/advanced-settings/sudo/)</sup>。

## 限制超级用户的权力

主导思想是最小权限原则，由杰罗姆·萨尔策和迈克尔·施罗德在 1975 年的论文《计算机系统中的信息保护》（*The Protection of Information in Computer Systems*）中提出：每个程序和每个用户都应使用完成工作所需的最小权限集来运行<sup>[8](https://www.cs.virginia.edu/~evans/cs551/saltzer/)</sup>。他们将该原则表述为在隔间之间何处安装“防火墙”的依据，并以军队的“按需知密”规则为例<sup>[8](https://www.cs.virginia.edu/~evans/cs551/saltzer/)</sup>。一项对 Linux、Windows、FreeBSD 和 Solaris 的调查指出，数据保护和出口管制法规可以使最小权限即使对系统管理员也成为强制要求<sup>[6](https://doi.org/10.1007/s12243-024-01033-5)</sup>。

**能力。** Linux 将超级用户相关的权限划分为称为能力的独立单元，从而可以将权限授予单个应用程序而无需以 root 运行它们<sup>[6](https://doi.org/10.1007/s12243-024-01033-5)</sup>。Linux 将超级用户的权威拆分为大约四十种能力，每一种都可以单独授予——例如绑定低编号端口的权限，Web 服务器可以单独获得该权限而无需 root。<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup> 某些通常只有 root 才能执行的操作可以由特定能力来授权；ping 需要原始[网络套接字](https://www.edgepedia.org/zh/network-socket)，可以授予它 CAP_NET_RAW 而不是将其设为 setuid root<sup>[3](https://unix.stackexchange.com/questions/267153/what-exactly-differentiates-the-root-user-from-every-other-user)</sup>。CAP_DAC_OVERRIDE 绕过文件系统访问控制规则，它说明了 root 的权力如何分解为不同的管理权限<sup>[6](https://doi.org/10.1007/s12243-024-01033-5)</sup>。该机制源自已被撤回的 POSIX 1003.1e 草案标准，这使得 Linux 开发者可以自由修改和扩展它<sup>[6](https://doi.org/10.1007/s12243-024-01033-5)</sup>。

**结构性方法。** 权限分离将一个程序结构化为一个只执行特权操作的小型特权部分和一个执行其他所有操作的大型非特权部分，两者通过管道或套接字对等狭窄通道连接<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup>。[基于角色的访问控制](https://www.edgepedia.org/zh/role-based-access-control)在账户层面走得更远：Oracle 的 Solaris 文档将 RBAC 呈现为对全有或全无的超级用户模型的更安全替代方案，它将能力归入权限配置文件，用户以角色身份来承担这些配置文件<sup>[18](https://docs.oracle.com/cd/E19120-01/open.solaris/819-3321/6n5i4b7ao/index.html)</sup>。在两种模型下，超级用户的操作都可以被审计；在 RBAC 下，这是通过审计权限配置 shell 中的命令来实现的，如果 root 用户被禁用，还可以记录承担该角色的用户名<sup>[18](https://docs.oracle.com/cd/E19120-01/open.solaris/819-3321/6n5i4b7ao/index.html)</sup>。

**去特权化研究。** Protego 原型仅通过修改 715 行 Linux 内核代码，就移除了超过 10,000 行 setuid 二进制代码的特权，在内核编译上的开销不到 2%<sup>[13](https://dl.acm.org/doi/10.1145/2592798.2592811)</sup>。同一项研究发现，大多数 setuid 专项解决方案针对的是 8 个需要管理员权限、但同时提供非特权用户所需功能的系统调用<sup>[13](https://dl.acm.org/doi/10.1145/2592798.2592811)</sup>。

## 数据一览

| 数量 | 数值 | 含义 |
|---|---|---|
| Linux 能力 | 约 40 种可分别授予的权限<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup> | root 权威可被划分的粒度 |
| 部署最广的 setuid 二进制文件 | Debian 和 Ubuntu 中 28 个<sup>[13](https://dl.acm.org/doi/10.1145/2592798.2592811)</sup> | 常见发行版上 setuid-root 程序的攻击面 |
| Protego 内核改动 | 715 行内核代码移除了超过 10,000 行用户代码的特权，内核编译开销不到 2%<sup>[13](https://dl.acm.org/doi/10.1145/2592798.2592811)</sup> | 移除 setuid-root 这一机制的代价 |
| sudo 凭据超时 | 默认 5 分钟<sup>[4](https://www.sudo.ws/docs/man/sudo.man/)</sup> | sudo 认证保持有效的时长 |
| PwnKit 暴露窗口 | pkexec 漏洞自 2009 年 5 月起存在，2022 年 1 月 25 日披露<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup> | 约 13 年间，任何本地用户都能在默认安装上获得 root |

## 跨系统比较

| 系统 | 超级用户模型 | 默认姿态 | 提权机制 |
|---|---|---|---|
| Unix/Linux | UID 0 账户（root）；内核跳过几乎所有权限检查<sup>[7](https://pk.org/classes/419/notes/access-2.html)</sup> |  | su（目标凭据）或 sudo（调用者凭据，5 分钟缓存）<sup>[10](https://www.sudo.ws/docs/man/sudoers.man/)</sup><sup> • </sup><sup>[4](https://www.sudo.ws/docs/man/sudo.man/)</sup> |
| Solaris | 以 RBAC 角色替代全有或全无的超级用户<sup>[18](https://docs.oracle.com/cd/E19120-01/open.solaris/819-3321/6n5i4b7ao/index.html)</sup> | 角色可取代直接使用 root；可禁用 root 并审计角色承担 | 以角色身份承担的权限配置文件<sup>[18](https://docs.oracle.com/cd/E19120-01/open.solaris/819-3321/6n5i4b7ao/index.html)</sup> |
| Windows | Administrators 组，由 UAC 双令牌居中调节<sup>[5](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)</sup> | 管理员默认以标准令牌运行 | 同意提示（管理员）或凭据提示（标准用户）<sup>[5](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)</sup> |
| Android | UID 0 存在，但不向设备所有者开放<sup>[3](https://unix.stackexchange.com/questions/267153/what-exactly-differentiates-the-root-user-from-every-other-user)</sup> | 所有者无法获得 root 访问权限 | 获取 root 权限，即授予所有者 root 访问权限的设置更改<sup>[3](https://unix.stackexchange.com/questions/267153/what-exactly-differentiates-the-root-user-from-every-other-user)</sup> |

Unix 和 Windows 模型在结构上有所不同：在 Linux 上，UID 0 进程通常在提权时获得其能力，但能力边界集可以屏蔽能力，安全控制还可以进一步限制它们，因此 root 的权威并非无条件；而 Windows 让每个管理员进程都保持在标准令牌上，直到逐进程的提权获得批准<sup>[20](https://man7.org/linux/man-pages/man7/capabilities.7.html)</sup>。Solaris 的 RBAC 用具名角色取代了单一的超级用户身份，而在大多数设置下，Android 不向设备所有者提供 Unix 超级用户。

## 近期发展

**run0。** systemd v256（2024）引入了 run0，一个类似 sudo 但非 SUID 的工具。它就是通过符号链接以 run0 之名调用的现有工具 systemd-run；它不是 setuid，而是请求 systemd 服务管理器（PID 1）以目标用户的 UID 来调用命令<sup>[19](https://fosspost.org/systemd-wants-to-expand-to-include-a-sudo-replacement/)</sup>。目标命令在一个从 PID 1 新派生出的隔离执行上下文中运行，除了列入允许列表的环境变量 $TERM 之外，不继承客户端的任何上下文<sup>[19](https://fosspost.org/systemd-wants-to-expand-to-include-a-sudo-replacement/)</sup>。

**Windows 上的 sudo。** 微软向 Windows 添加了一个通过 UAC 提权的 sudo 命令；与 runas 不同，它尚不支持以其他用户身份运行程序，这仍在路线图上<sup>[17](https://learn.microsoft.com/en-us/windows/advanced-settings/sudo/)</sup>。

**RootAsRole。** RootAsRole 项目旨在通过在用户层面控制能力来简化 Linux 权限管理；其作者指出 sudo 不处理 Linux 能力<sup>[6](https://doi.org/10.1007/s12243-024-01033-5)</sup>。

**对 sudo 的重新审视。** CVE-2026-82474 的拦截模式策略绕过<sup>[14](https://nvd.nist.gov/vuln/detail/cve-2026-82474)</sup>以及 Ubuntu 公告 USN-8803-1<sup>[15](https://ubuntu.com/security/notices/USN-8803-1)</sup> 和 USN-8895-1<sup>[16](https://ubuntu.com/security/notices/USN-8895-1)</sup> 使人们的注意力持续集中在 sudo 所依赖的 setuid-root 模型上，进一步增强了 run0 的 PID 1 中介和 RootAsRole 等基于能力的工具这类替代方案的吸引力。

## References

1. [Operating Systems: Three Easy Pieces, Security chapter: Access Control (Arpaci-Dusseau)](https://pages.cs.wisc.edu/~remzi/OSTEP/security-access.pdf)
2. [The Superuser (UID 0), UNIX Power Tools, O'Reilly](https://docstore.mik.ua/orelly/other/Docs/oreilly/other2/puis3rd/0596003234_puis3-chp-5-sect-2.html)
3. [What exactly differentiates the root user from every other user? Unix & Linux Stack Exchange](https://unix.stackexchange.com/questions/267153/what-exactly-differentiates-the-root-user-from-every-other-user)
4. [Sudo Manual, sudo project](https://www.sudo.ws/docs/man/sudo.man/)
5. [How User Account Control works, Microsoft Learn](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/how-it-works)
6. [Implementing the principle of least administrative privilege on operating systems: challenges and perspectives](https://doi.org/10.1007/s12243-024-01033-5)
7. [Access Control - Part 2, operating systems security course notes (pk.org)](https://pk.org/classes/419/notes/access-2.html)
8. [Saltzer and Schroeder, The Protection of Information in Computer Systems (1975)](https://www.cs.virginia.edu/~evans/cs551/saltzer/)
9. [Interview: Inventing The Unix "sudo" Command, Hackaday](https://hackaday.com/2014/05/28/interview-inventing-the-unix-sudo-command/)
10. [Sudoers Manual, sudo project](https://www.sudo.ws/docs/man/sudoers.man/)
11. [sudo(8), Linux manual page, man7.org](https://man7.org/linux/man-pages/man8/sudo.8.html)
12. [super(1), Debian manpage](https://manpages.debian.org/bookworm/super/super.1.en.html)
13. [Practical techniques to obviate setuid-to-root binaries, ACM](https://dl.acm.org/doi/10.1145/2592798.2592811)
14. [CVE-2026-82474, National Vulnerability Database](https://nvd.nist.gov/vuln/detail/cve-2026-82474)
15. [USN-8803-1: Sudo vulnerability, Ubuntu](https://ubuntu.com/security/notices/USN-8803-1)
16. [USN-8895-1: Sudo vulnerability, Ubuntu](https://ubuntu.com/security/notices/USN-8895-1)
17. [Sudo for Windows, Microsoft Learn](https://learn.microsoft.com/en-us/windows/advanced-settings/sudo/)
18. [RBAC: An Alternative to the Superuser Model, Oracle Solaris Security Guide](https://docs.oracle.com/cd/E19120-01/open.solaris/819-3321/6n5i4b7ao/index.html)
19. [Systemd Wants To Expand To Include A Sudo Replacement, FOSS Post](https://fosspost.org/systemd-wants-to-expand-to-include-a-sudo-replacement/)
20. [capabilities(7) - Linux manual page](https://man7.org/linux/man-pages/man7/capabilities.7.html)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 19, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Operating systems › Operating system concepts

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/superuser

English original: https://www.edgepedia.org/superuser
