Merge pull request #98676 from cole-h/shadow-owns-shadow

nixos/update-users-groups: /etc/shadow owned by root:shadow
This commit is contained in:
WORLDofPEACE 2020-09-26 15:37:57 -04:00 committed by GitHub
commit c4d016a28b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View file

@ -281,6 +281,12 @@ foreach my $u (values %usersOut) {
}
updateFile("/etc/shadow", \@shadowNew, 0600);
{
my $uid = getpwnam "root";
my $gid = getgrnam "shadow";
my $path = "/etc/shadow";
chown($uid, $gid, $path) || die "Failed to change ownership of $path: $!";
}
# Rewrite /etc/subuid & /etc/subgid to include default container mappings

View file

@ -537,6 +537,7 @@ in {
input.gid = ids.gids.input;
kvm.gid = ids.gids.kvm;
render.gid = ids.gids.render;
shadow.gid = ids.gids.shadow;
};
system.activationScripts.users = stringAfter [ "stdio" ]

View file

@ -346,6 +346,7 @@ in
paperless = 315;
#mailman = 316; # removed 2019-08-30
zigbee2mqtt = 317;
# shadow = 318; # unused
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -647,6 +648,7 @@ in
paperless = 315;
#mailman = 316; # removed 2019-08-30
zigbee2mqtt = 317;
shadow = 318;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal