[source] base-files: fix check for empty password warning

LEDE Commits lede-commits at lists.infradead.org
Mon Sep 26 08:59:43 PDT 2016


neoraider pushed a commit to source.git, branch master:
https://git.lede-project.org/6c1542787d135de358710254e71fe926f8676954

commit 6c1542787d135de358710254e71fe926f8676954
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Mon Sep 26 15:25:37 2016 +0200

    base-files: fix check for empty password warning
    
    Now that we know that the password is in /etc/shadow and not in
    /etc/passwd, we can properly fix the logic for the empty password check.
    Only 'root::' is an empty password, 'root:x:' and 'root:!:' allow no
    password login at all.
    
    This fixes the empty password warning still showing after the root password
    has been locked using 'passwd -l root' (e.g. to allow public-key auth
    only).
    
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 package/base-files/files/etc/profile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
index d70bafc..f241ab2 100644
--- a/package/base-files/files/etc/profile
+++ b/package/base-files/files/etc/profile
@@ -30,8 +30,7 @@ alias ll='ls -alF --color=auto'
 	unset FILE
 }
 
-if ( grep -qsE '^root:[!x]?:' /etc/shadow && \
-     grep -qsE '^root:[!x]?:' /etc/passwd  && \
+if ( grep -qs '^root::' /etc/shadow && \
      [ -z "$FAILSAFE" ] )
 then
 cat << EOF



More information about the lede-commits mailing list