From 925b028f1779027d65ef75ecc87563c45805d0c3 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Sun, 26 Aug 2018 22:33:29 -0700 Subject: [PATCH] nixos/shadow: create setuid wrapper for chsh This allows non-declarative users to change their login shells. https://github.com/NixOS/nixpkgs/pull/41966 will make this possible for declarative users as well if the system config explicitly allows it. --- nixos/modules/programs/shadow.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix index 8ec4169207db..824e451014e6 100644 --- a/nixos/modules/programs/shadow.nix +++ b/nixos/modules/programs/shadow.nix @@ -108,8 +108,9 @@ in newgrp.source = "${pkgs.shadow.out}/bin/newgrp"; newuidmap.source = "${pkgs.shadow.out}/bin/newuidmap"; newgidmap.source = "${pkgs.shadow.out}/bin/newgidmap"; - } // (if config.users.mutableUsers then { + } // lib.optionalAttrs config.users.mutableUsers { + chsh.source = "${pkgs.shadow.out}/bin/chsh"; passwd.source = "${pkgs.shadow.out}/bin/passwd"; - } else {}); + }; }; }