nixos/update-users-groups: /etc/shadow owned by root:shadow

This commit is contained in:
Cole Helbling 2020-09-24 13:28:52 -07:00
parent d6d1c121e1
commit 937359fcf1
No known key found for this signature in database
GPG Key ID: B37E0F2371016A4C
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