summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2016-09-17 04:21:25 +0200
committerJohn Crispin <john@phrozen.org>2016-09-19 15:30:32 +0200
commit63bd73a5cfc3501c7fbeacb629da12d8278ea352 (patch)
treeb239856131fcffee33f1f8381e8d68fc73af264f /package/base-files
parent0b3a64f862b367e634d1d4f8b4b94a10e0128dd4 (diff)
downloadmtk-20170518-63bd73a5cfc3501c7fbeacb629da12d8278ea352.zip
mtk-20170518-63bd73a5cfc3501c7fbeacb629da12d8278ea352.tar.gz
mtk-20170518-63bd73a5cfc3501c7fbeacb629da12d8278ea352.tar.bz2
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 <john@phrozen.org>
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/files/etc/profile13
1 files changed, 13 insertions, 0 deletions
diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
index f2def7f..d70bafc 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