base-files: Allow to disable failsafe mode
[openwrt/svn-archive/archive.git] / package / base-files / files / bin / login.sh
index a64c84e1e2dc918086cbadad0b78366a29cd7f09..754d29085762437fc976bc2b2d1531c34b35c473 100755 (executable)
@@ -1,14 +1,16 @@
 #!/bin/sh
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 
-if grep -qs '^root:[^!]' /etc/passwd /etc/shadow && [ -z "$FAILSAFE" ]; then
+if ( ! grep -qsE '^root:[!x]?:' /etc/shadow || \
+     ! grep -qsE '^root:[!x]?:' /etc/passwd ) && \
+   [ -z "$FAILSAFE" ]
+then
        echo "Login failed."
        exit 0
 else
 cat << EOF
  === IMPORTANT ============================
-  Use 'passwd' to set your login password
-  this will disable telnet and enable SSH
+  Use 'passwd' to set your login password!
  ------------------------------------------
 EOF
 fi