[source] base-files: remind users to set root password

LEDE Commits lede-commits at lists.infradead.org
Mon Sep 19 06:30:57 PDT 2016


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/63bd73a5cfc3501c7fbeacb629da12d8278ea352

commit 63bd73a5cfc3501c7fbeacb629da12d8278ea352
Author: John Crispin <john at phrozen.org>
AuthorDate: Sat Sep 17 04:21:25 2016 +0200

    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 at phrozen.org>
---
 package/base-files/files/etc/profile | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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



More information about the lede-commits mailing list