diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-01 14:50:24 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-01 15:04:21 +0100 |
commit | 20093751ec96b43d87f0850fc3ad541237405564 (patch) | |
tree | 5ee3c0083d75804a8aad42d3cb64d1b78b41964d /nixos/modules/config | |
parent | 4ba7dfde5b79ec835e8739922400b3f5f4f089f2 (diff) | |
download | nixlib-20093751ec96b43d87f0850fc3ad541237405564.tar nixlib-20093751ec96b43d87f0850fc3ad541237405564.tar.gz nixlib-20093751ec96b43d87f0850fc3ad541237405564.tar.bz2 nixlib-20093751ec96b43d87f0850fc3ad541237405564.tar.lz nixlib-20093751ec96b43d87f0850fc3ad541237405564.tar.xz nixlib-20093751ec96b43d87f0850fc3ad541237405564.tar.zst nixlib-20093751ec96b43d87f0850fc3ad541237405564.zip |
Print a reminder to users to set or disable the root password
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/users-groups.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index 79570fc25713..714de646eb7a 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -258,6 +258,22 @@ in fi ''; + # Print a reminder for users to set a root password. + environment.interactiveShellInit = + '' + if [ "$UID" = 0 ]; then + read _l < /etc/shadow + if [ "''${_l:0:6}" = root:: ]; then + cat >&2 <<EOF + [1;31mWarning:[0m Your root account has a null password, allowing local users + to login as root. Please set a non-null password using \`passwd', or + disable password-based root logins using \`passwd -l'. + EOF + fi + unset _l + fi + ''; + system.activationScripts.users = stringAfter [ "groups" ] '' echo "updating users..." |