summary refs log tree commit diff
diff options
context:
space:
mode:
authorJesper Geertsen Jonsson <yesbox@users.noreply.github.com>2018-01-14 18:15:46 +0100
committerJesper Geertsen Jonsson <yesbox@users.noreply.github.com>2018-01-14 20:54:40 +0100
commit8c0558dbb2469b7799515abd108d2fa4adbc4636 (patch)
treee96c7335da89c26d9463b28597935b1e1c36d09b
parent620ae7be2bc71c2ff5f904660d9841f577c67a84 (diff)
downloadnixpkgs-8c0558dbb2469b7799515abd108d2fa4adbc4636.tar
nixpkgs-8c0558dbb2469b7799515abd108d2fa4adbc4636.tar.gz
nixpkgs-8c0558dbb2469b7799515abd108d2fa4adbc4636.tar.bz2
nixpkgs-8c0558dbb2469b7799515abd108d2fa4adbc4636.tar.lz
nixpkgs-8c0558dbb2469b7799515abd108d2fa4adbc4636.tar.xz
nixpkgs-8c0558dbb2469b7799515abd108d2fa4adbc4636.tar.zst
nixpkgs-8c0558dbb2469b7799515abd108d2fa4adbc4636.zip
sg/newgrp should always be available, not chfn
sg and newgrp only changes the current user session and should be
available to users even if the "users.mutableUsers" option is set.
These are common, useful commands.

chfn does modify the /etc/passwd GECOS field which is also controlled
by the option "users.users.<name?>.description", so it's less
appropriate to make it available when "users.mutableUsers" is set.

However, because CHFN_RESTRICT in login.defs is never set in current
NixOS the chfn functionality is never available to users anyway and
may as well have its SUID disabled, as only root is able to use it.
This is recommended in the chfn man page in this case.
-rw-r--r--nixos/modules/programs/shadow.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix
index 0f3f42901ba..8ec4169207d 100644
--- a/nixos/modules/programs/shadow.nix
+++ b/nixos/modules/programs/shadow.nix
@@ -26,8 +26,9 @@ let
       # Ensure privacy for newly created home directories.
       UMASK        077
 
-      # Uncomment this to allow non-root users to change their account
-      #information.  This should be made configurable.
+      # Uncomment this and install chfn SUID to allow non-root
+      # users to change their account GECOS information.
+      # This should be made configurable.
       #CHFN_RESTRICT frwh
 
     '';
@@ -103,13 +104,12 @@ in
 
     security.wrappers = {
       su.source        = "${pkgs.shadow.su}/bin/su";
-      chfn.source      = "${pkgs.shadow.out}/bin/chfn";
+      sg.source        = "${pkgs.shadow.out}/bin/sg";
+      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 {
       passwd.source    = "${pkgs.shadow.out}/bin/passwd";
-      sg.source        = "${pkgs.shadow.out}/bin/sg";
-      newgrp.source    = "${pkgs.shadow.out}/bin/newgrp";
     } else {});
   };
 }