0
  #   ˆl–Ðz¾”d*j"T%õÆß¸”Å£Â„Ï¼ïÁÀ ?÷     ---
title: Users, Groups, UIDs and GIDs on systemd Systems
category: Users, Groups and Home Directories
layout: default
SPDX-License-Identifier: LGPL-2.1-or-later
---

# Users, Groups, UIDs and GIDs on systemd Systems

Here's a summary of the requirements `systemd` (and Linux) make on UID/GID
assignments and their ranges.

Note that while in theory UIDs and GIDs are orthogonal concepts they really
aren't IRL. With that in mind, when we discuss UIDs below it should be assumed
that whatever we say about UIDs applies to GIDs in mostly the same way, and all
the special assignments and ranges for UIDs always have mostly the same
validity for GIDs too.

## Special Linux UIDs

In theory, the range of the C type `uid_t` is 32bit wide on Linux,
i.e. 0â€¦4294967295. However, four UIDs are special on Linux:

1. 0 â†’ The `root` super-user

2. 65534 â†’ The `nobody` UID, also called the "overflow" UID or similar. It's
   where various subsystems map unmappable users to, for example file systems
   only supporting 16bit UIDs, NFS or user namespacing. (The latter can be
   changed with a sysctl during runtime, but that's not supported on
   `systemd`. If you do change it you void your warranty.) Because Fedora is a
   bit confused the `nobody` user is called `nfsnobody` there (and they have a
   different `nobody` user at UID 99). I hope this will be corrected eventually
   though. (Also, some distributions call the `nobody` group `nogroup`. I wish
   they didn't.)

3. 4294967295, aka "32bit `(uid_t) -1`" â†’ This UID is not a valid user ID, as
   `setresuid()`, `chown()` and friends treat -1 as a special request to not
   change the UID of the process/file. This UID is hence not available for
   assignment to users in the user database.

4. 65535, aka "16bit `(uid_t) -1`" â†’ Before Linux kernel 2.4 `uid_t` used to be
   16bit, and programs compiled for that would hence assume that `(uid_t) -1`
   is 65535. This UID is hence not usable either.

The `nss-systemd` glibc NSS module will synthesize user database records for
the UIDs 0 and 65534 if the system user database doesn't list them. This means
that any system where this module is enabled works to some minimal level
without `/etc/passwd`.

## Special Distribution UID ranges

Distributions generally split the available UID range in two:

1. 1â€¦999 â†’ System users. These are users that do not map to actual "human"
   users, but are used as security identities for system daemons, to implement
   privilege separation and run system daemons with minimal privileges.

2. 1000â€¦65533 and 65536â€¦4294967294 â†’ Everything else, i.e. regular (human) users.

Note that most distributions allow changing the boundary between system and
regular users, even during runtime as user configuration. Moreover, some older
systems placed the boundary at 499/500, or even 99/100. In `systemd`, the
boundary is configurable only during compilation time, as this should be a
decision for distribution builders, not for users. Moreover, we strongly
discourage downstreams to change the boundary from the upstream default of
999/1000.

Also note that programs such as `adduser` tend to allocate from a subset of the
available regular user range only, usually 1000..60000. And it's also usually
user-configurable, too.

Note that systemd requires that system users and groups are resolvable without
networking available â€” a requirement that is not made for regular users. This
means regular users may be stored in remote LDAP or NIS databases, but system
users may not (except when there's a consistent local cache kept, that is
available during earliest boot, including in the initrd).

## Special `systemd` GIDs

`systemd` defines no special UIDs beyond what Linux already defines (see
above). However, it does define some special group/GID assignments, which are
primarily used for `systemd-udevd`'s device management. The precise list of the
currently defined groups is found in this `sysusers.d` snippet:
[basic.conf](https://raw.githubusercontent.com/systemd/systemd/ma