Memory-safe Rust reimplementation of Linux shadow-utils (useradd, passwd, groupadd, etc.)
Repo uutils/shadow, read from GitHub 1 min ago. uutils has not joined Take My Repo.
uutils/shadow is a public repo on GitHub by uutils. Memory-safe Rust reimplementation of Linux shadow-utils (useradd, passwd, groupadd, etc.). It declares the MIT license on GitHub. It is written mainly in Rust, has 20 stars and last changed on 2026-11-18. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-20.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
A memory-safe reimplementation of the Linux
shadow-utils in
Rust. shadow-utils (useradd, passwd,
groupadd, etc.) is the suite of setuid-root tools that manages user accounts,
passwords, and groups on every Linux system.
shadow-utils runs as root or setuid-root on every Linux system. It parses
user-supplied input, writes to /etc/passwd, /etc/shadow, /etc/group, and
has had recent CVEs (CVE-2023-4641: password leak in memory, CVE-2024-56433:
subuid collision enabling account takeover). Before this project there was
no Rust reimplementation — not in uutils, not in Prossimo/Trifecta, not on
crates.io.
sudo-rs proved the model: an independent Rust rewrite of a privilege-boundary tool can go from zero to default-in-Ubuntu in under 3 years. This project follows that playbook.
uucore
with the standard uumain() / uu_app() API contract. Designed to merge
into the uutils ecosystem.zeroize.proptest), integration
tests, fuzz targets for all parsers. Tested on Debian, Alpine (musl), and
Fedora.cargo-deny license and advisory
checks, no GPL dependencies.| Tool | Status |
|---|---|
passwd |
All 16 flags implemented. Drop-in for upstream passwd. PAM password change, Landlock sandboxing, --root, --quiet, --stdin. -S output and exit codes compared with the distribution's passwd by make test-upstream-compat. |
pwck |
Implemented. Silent on clean files, each problem on stdout and pwck: no changes after them. Offers no repairs; see pwck(8). |
useradd |
Implemented. UID/GID allocation, home dir + skel, shadow entry, group creation. |
userdel |
Implemented. Remove from all system files, optional home/mail cleanup. |
usermod |
Implemented. Modify account properties and group membership (-G, -a, -r), lock/unlock, set pre-hashed password, subordinate IDs, move the home (-m) and re-own it through descriptors. |
chpasswd |
Implemented. Batch password change from stdin. |
chage |
Implemented. Password aging management; -l (with -i for ISO dates) for a user's own account, setgid shadow. With only a login, prompts for each field. |
groupadd |
Implemented. Auto GID allocation, system groups, force mode, initial members. |
groupdel |
Implemented. Primary group usage check, force mode. |
groupmod |
Implemented. GID change, rename, password, member list in group and gshadow. |
grpck |
Implemented. Silent on clean files, each problem on stdout and grpck: no changes after them. Offers no repairs; see grpck(8). |
chfn |
Implemented. GECOS sub-field modification. |
chsh |
Implemented. Shell change with /etc/shells validation. |
newgrp |
Implemented. Effective group change with crypt verification. |
gpasswd |
Implemented. Group membership, administrators, and group password. |
sg |
Implemented. Runs one command in another group; shares newgrp's authorization. |
chgpasswd |
Implemented. Batch group passwords, applied all-or-nothing. |
newusers |
Implemented. Batch account creation: passwd, shadow, group and home. |
vipw |
Implemented. Edit passwd or shadow under the suite's lock; the result is checked before it is installed. |
vigr |
Implemented. vipw for group and gshadow. |
pwconv |
Implemented. Moves hashes from passwd into shadow and reconciles the two; shadow is written first so a failure loses nothing. |
pwunconv |
Implemented. Merges hashes back into passwd and removes shadow. |
grpconv |
Implemented. pwconv for group and gshadow. |
grpunconv |
Implemented. pwunconv for group and gshadow. |
login |
Implemented. What getty runs: prompts, PAM authentication and session, utmp/wtmp, terminal handover, a login shell. Needs the pam feature. |
newuidmap |
Implemented. Writes a user namespace's uid_map within the caller's /etc/subuid grant; what rootless containers call. |
newgidmap |
Implemented. newuidmap for gid_map and /etc/subgid. |
expiry |
Implemented. Checks the caller's own password aging and forces the change login would; setgid shadow. |
The target is the set of binaries the upstream shadow suite ships, as the
distributions package it. That set was established from package metadata and
man pages, never from the upstream source: this project is a clean-room
reimplementation and reads no GPL code. Behaviour is established by running the
package: the reference is Ubuntu 26.04's passwd (1:4.17.4-2ubuntu3), with
Debian as a comparison.
Debian and Fedora do not ship the same set. The 22 tools they agree on are all implemented. Of the rest:
| tool | status |
|---|---|
login |
shipped. Debian 13, Ubuntu 25.10 and Ubuntu 26.04 take login from util-linux, but Ubuntu 20.04, 22.04 and 24.04 and Debian 12 ship shadow's, and uutils/login was archived pointing here. It implements the option set the two share, plus util-linux's -H |
newgrp, sg |
shipped. Debian 13 and Ubuntu 26.04 take them from util-linux; the releases above that keep shadow's login keep these too |
expiry |
shipped |
groupmems |
out of scope. Debian 13, Fedora and Ubuntu 26.04 do not ship it; Ubuntu 24.04 does, without a /etc/pam.d/groupmems, so every action there fails against PAM's default — a tool one distribution ships and none can use |
faillog, lastlog |
left the Debian package with 13, and are not in Ubuntu 26.04; not planned |
newuidmap, newgidmap |
shipped. Fedora's pair, the basis of rootless containers |
shadowconfig, cpgr, cppw, adduser |
Debian packaging scripts and a Fedora symlink, not upstream tools; out of scope |
Three tools that the upstream suite ships are provided by other projects in this
organisation, and are deliberately not duplicated here — the same rule
uutils/procps and uutils/util-linux apply between themselves:
nologin is in uutils/util-linux. Debian has taken it from util-linux for years; shadow's copy is not shipped.su is in sudo-rs.login is here: on much of the installed base it is shadow's tool, whatever the newest releases do.Differences with the upstream tools are treated as bugs, with one class of exceptions: a behaviour that quietly weakens the system is refused rather than reproduced. Each refusal is loud, names the alternative, and is documented in the tool's man page under Differences from upstream shadow, as are the differences still open. The pattern so far:
-m, -c MD5, -c DES) and unhashed storage
(-c NONE) are refused by chpasswd, chgpasswd and newusers."" yields a hash a
bare Enter matches, which is an account anyone can enter, not one with no
password.vipw and vigr parse the edited file before installing it — upstream
installs whatever the editor saved — and keep the edit when they refuse it.newusers refuses a group name that does not exist rather than leaving the
account pointing at a GID that is not there.newgrp and sg prompt for a password whether or not the group has one, so
the presence of a prompt no longer reveals which groups are worth attacking.usermod re-owns a home through descriptors and keeps going after a failure.
usermod(8) lists what that changes: someone else's hard link keeps its group,
a symlinked home is refused however it is spelled, a failure does not stop the
walk, an entry deleted during the walk is not one, set-user-ID bits go when a
copied home is re-owned, and a moved home that is not the user's is not walked.Nothing falls back silently. Where the upstream tool and this one disagree on a result, the exit code says so.
git clone https://github.com/uutils/shadow
cd shadow
docker compose build debian
docker compose run --rm debian cargo build --releaseDefault install: 28 standalone per-tool binaries with least-privilege setuid
layout matching the upstream shadow-utils package. Only passwd, chfn, chsh, newgrp,
gpasswd, sg, newuidmap and newgidmap are installed setuid-root, expiry and chage are setgid shadow (enough to read a user's own /etc/shadow line, which expiry and chage -l need); the other 18 are plain 0755.
On a system with no shadow group -- Fedora, Arch -- those two are installed setuid-root instead, the way those systems ship upstream's chage; a group under another name is named with SHADOW_GROUP=.
sudo make install PREFIX=/usr/local
Alternative: single multicall binary with symlinks. Smaller footprint (~15×
disk savings). The binary is installed setuid-root so that passwd, chfn,
chsh, newgrp, gpasswd, sg, newuidmap and newgidmap can serve unprivileged callers; every other
applet drops back to the caller's uid before it runs, so the privilege model
is the same as the per-tool layout. Intended for container/embedded use cases.
sudo make install-multicall PREFIX=/usr/local
Each release publishes three
archives, each with a .sha256 alongside. They contain the same shadow-rs
multicall binary but the two kinds are not interchangeable:
| Archive | libc | Linking | Use it for |
|---|---|---|---|
uu_shadow-x86_64-unknown-linux-gnu.tar.gz |
glibc | dynamic | Any regular distribution. This is the full build. |
uu_shadow-aarch64-unknown-linux-gnu.tar.gz |
glibc | dynamic | The same build for arm64 servers and Apple-silicon containers. |
uu_shadow-x86_64-unknown-linux-musl-static.tar.gz |
musl | static | Minimal containers and embedded images: local /etc/passwd, no directory service, no PAM stack. |
The static archive has no runtime dependencies, and pays for that with three capabilities a static binary cannot have — none of them cosmetic for account tools:
passwd cannot change a password interactively, and chfn /
chsh are root-only (they authenticate the caller through PAM and fail
closed without it).$y$). The default password hash on Debian 12+,
Ubuntu 24.04 and Ubuntu 26.04 can be neither verified nor produced.If any of those matter on the host, use a glibc archive. docs/PLATFORM-SUPPORT.md explains each gap, what still works, and how the archive is built.
Every archive ships a plain binary — nothing is installed, symlinked, or made
setuid by extracting it. To deploy it the same way make install-multicall
would:
tar xzf uu_shadow-x86_64-unknown-linux-gnu.tar.gz # or the -musl-static one sudo install -o root -g root -m 4755 \ uu_shadow-*/shadow-rs /usr/local/bin/shadow-rs for tool in passwd chfn chsh newgrp gpasswd sg chage chpasswd chgpasswd newusers \ groupadd groupdel groupmod grpck pwck useradd userdel usermod vipw vigr \ pwconv pwunconv grpconv grpunconv login newuidmap newgidmap expiry; do sudo ln -sf shadow-rs "/usr/local/bin/$tool" done
Mode 4755 is what the ten applets that keep euid 0 need; the others give
the privilege up before running. Run shadow-rs --list to see the applets a
given build contains, and sha256sum -c uu_shadow-*.tar.gz.sha256 to verify
a download.
All builds and tests run inside Docker containers to isolate from the host system. Three distros are tested to catch libc and PAM differences:
docker compose run --rm debian cargo test --workspace # Debian Trixie (glibc) docker compose run --rm alpine cargo test --workspace # Alpine (musl libc) docker compose run --rm fedora cargo test --workspace # Fedora
docker compose run --rm debian cargo clippy --workspace --all-targets -- -D warnings docker compose run --rm debian cargo fmt --all --check
Cargo workspace monorepo built on uucore:
src/bin/shadow-rs.rs multicall binary (dispatches by argv[0])
|
src/uu/{tool}/ individual tool crates (passwd, useradd, ...)
|
┌────┴────┐
uucore shadow-core shared infrastructure + domain library
Tools use uucore for the standard uutils API (UResult, #[uucore::main],
show_error!) and shadow-core for domain-specific functionality.
shadow-core provides:
/etc/passwd, /etc/shadow, /etc/group, /etc/gshadow,
/etc/login.defs, /etc/subuid, /etc/subgid: or control characters can
reach a record)Each tool crate exports uumain() and uu_app(), following
uutils conventions exactly so a future
merge is frictionless.
| Target | Base | libc | PAM | SELinux |
|---|---|---|---|---|
debian |
rust:1.99-trixie |
glibc | Linux-PAM | headers |
alpine |
rust:1.99-alpine3.23 |
musl | Linux-PAM | none |
fedora |
fedora:46 |
glibc | Linux-PAM | headers |
SELinux is not enforced in any of them: a container has no /sys/fs/selinux
unless its host runs SELinux. These images are where the suite runs; behaviour
is established against Ubuntu 26.04's package, as under Scope.
The alpine image tests musl with dynamic linking, PAM included. The static
musl release archive is a different build — no PAM, no NSS, no yescrypt — and
has its own CI job that builds it and runs shadow-core's unit tests against
static musl on every pull request. See
docs/PLATFORM-SUPPORT.md.
Security patterns from OpenBSD
(ISC license). PAM integration patterns from
sudo-rs (Apache-2.0/MIT).
uutils infrastructure via uucore (MIT).
See CONTRIBUTING.md for guidelines.
Important: uutils/shadow is an independent implementation, developed under a clean-room policy. Do not read, reference, or feed into an LLM any code from shadow-maint/shadow. Reference only: POSIX specs, man pages, BSD-licensed implementations (FreeBSD, OpenBSD, musl), and sudo-rs.
uutils/shadow is licensed under the MIT License.
The upstream shadow-utils suite, shadow-maint/shadow,
is not a GNU project. Its tree is BSD-3-Clause for the most part, with files
under the GPL 2.0 or later among them (su.c, vipw.c, contributed scripts,
some translated manuals); Fedora tags the package BSD-3-Clause AND GPL-2.0-or-later. This project takes nothing from either part: it is written
from the specifications, and is MIT throughout.
uutils/shadow is a public repo on GitHub by uutils. Memory-safe Rust reimplementation of Linux shadow-utils (useradd, passwd, groupadd, etc.).
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-18. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Rust implementation of findutils
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/uutils/shadowTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.