summaryrefslogtreecommitdiffstats
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
parent0b3a64f862b367e634d1d4f8b4b94a10e0128dd4 (diff)
downloadmaster-31e0f0ae-63bd73a5cfc3501c7fbeacb629da12d8278ea352.tar.gz
master-31e0f0ae-63bd73a5cfc3501c7fbeacb629da12d8278ea352.tar.bz2
master-31e0f0ae-63bd73a5cfc3501c7fbeacb629da12d8278ea352.zip
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>
-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 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