From: John Crispin Date: Sat, 17 Sep 2016 02:21:25 +0000 (+0200) Subject: base-files: remind users to set root password X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=63bd73a5cfc3501c7fbeacb629da12d8278ea352;p=openwrt%2Fstaging%2Faparcar.git base-files: remind users to set root password print a warning when a shell spawns, telling users to set a root password. Signed-off-by: John Crispin --- diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index f2def7fc0b..d70bafca49 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -29,3 +29,16 @@ alias ll='ls -alF --color=auto' done unset FILE } + +if ( grep -qsE '^root:[!x]?:' /etc/shadow && \ + grep -qsE '^root:[!x]?:' /etc/passwd && \ + [ -z "$FAILSAFE" ] ) +then +cat << EOF +=== WARNING! ===================================== +There is no root password defined on this device! +Use the "passwd" command to set up a new password +in order to prevent unauthorized SSH logins. +-------------------------------------------------- +EOF +fi