Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
nixos/update-users-groups: /etc/shadow owned by root:shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-h committed Sep 25, 2020
1 parent d6d1c12 commit 937359f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nixos/modules/config/update-users-groups.pl
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ sub parseUser {
}

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

Expand Down
1 change: 1 addition & 0 deletions nixos/modules/config/users-groups.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
2 changes: 2 additions & 0 deletions nixos/modules/misc/ids.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 937359f

Please sign in to comment.