Просмотр исходного кода

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 <[email protected]>
John Crispin 9 лет назад
Родитель
Сommit
63bd73a5cf
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      package/base-files/files/etc/profile

+ 13 - 0
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