Skip to content

install: cope with a system that has no shadow group - #309

Merged
pierre-warnier merged 1 commit into
mainfrom
fix/306-shadow-group
Sep 15, 2026
Merged

pierre-warnier merged 1 commit into
mainfrom
fix/306-shadow-group

Conversation

@pierre-warnier

Copy link
Copy Markdown
Collaborator

Fixes #306.

make install put expiry setgid shadow, which is how Debian and Ubuntu ship it, and failed outright wherever that group does not exist. Fedora and Arch have none: /etc/shadow there is readable by root alone. A packager's chroot may lack the group whatever the target. The Arch packager had to sed the Makefile, and the result, setgid to a group with no rights on the file, left expiry unable to read it for anyone but root.

Probed before choosing: Debian ships expiry and chage 2755 root:shadow; Fedora and Arch ship no expiry at all and ship chage, the tool that reads /etc/shadow on a user's behalf, 4755 root. That is the convention expiry now follows where the group is absent. It buys a user nothing more, since expiry checks the real uid and reads that one line. SHADOW_GROUP= names a group that goes by another name. The choice is made once, at make time, from getent, and the install summary says which layout was used.

Verified in the debian image with the group (2755 root:shadow) and with SHADOW_GROUP set to a group that does not exist (4755 root), and in the fedora image, where make install now completes; under each layout expiry -c answers an unprivileged user with exit 0 on a fresh account.

`make install` put expiry setgid `shadow`, which is how Debian and Ubuntu
ship it, and failed outright wherever that group does not exist: Fedora
and Arch have none -- /etc/shadow there is readable by root alone -- and
a packager's chroot may lack it whatever the target. The Arch packager
had to sed the Makefile (#306), and the result, setgid to a group with
no rights on the file, left expiry unable to read it for anyone but
root.

On those systems the GNU tool that reads /etc/shadow on a user's behalf,
chage, is setuid root; that is the convention expiry now follows where
the group is absent. It buys a user nothing more: expiry checks the real
uid and reads that one line. SHADOW_GROUP names a group that goes by
another name. The choice is made once, at make time, from getent, and
the install summary says which layout was used.

Verified in the debian image with the group (2755 root:shadow) and with
SHADOW_GROUP pointing at a group that does not exist (4755 root), and in
the fedora image, where `make install` now completes; under each layout
`expiry -c` answers an unprivileged user.
@pierre-warnier
pierre-warnier merged commit 91c9fc1 into main Sep 15, 2026
13 checks passed
@pierre-warnier
pierre-warnier deleted the fix/306-shadow-group branch September 15, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Makefile: shadow group does not exist on some system

1 participant