3
0
Fork 0
forked from mirrors/nixpkgs

Print a reminder to users to set or disable the root password

This commit is contained in:
Eelco Dolstra 2013-11-01 14:50:24 +01:00
parent 4ba7dfde5b
commit 20093751ec

View file

@ -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
Warning: 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..."