diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-06-27 18:46:18 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-06-27 18:58:15 +0300 |
commit | 2aa0e8f0d48d0c6cae0989bfbff717c21c48e199 (patch) | |
tree | 50176275644f2706047728f3b54d64e0c65d82e7 /etc | |
parent | 8d0faf748fe13692bce26fd4833b707c4f5e0d59 (diff) |
SSH: fix root password in Raspbianv0.57.16
Diffstat (limited to 'etc')
-rw-r--r-- | etc/ncp-config.d/SSH.sh | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/etc/ncp-config.d/SSH.sh b/etc/ncp-config.d/SSH.sh index cbf72263..0693753f 100644 --- a/etc/ncp-config.d/SSH.sh +++ b/etc/ncp-config.d/SSH.sh @@ -53,14 +53,16 @@ configure() local SHADOW="$( grep -E '^pi:' /etc/shadow )" test -n "${SHADOW}" && { local SALT=$(echo "${SHADOW}" | sed -n 's/pi:\$6\$//;s/\$.*//p') - local HASH=$(mkpasswd -msha-512 raspberry "$SALT") - grep -q "${HASH}" <<< "${SHADOW}" && { - systemctl stop ssh - systemctl disable ssh - echo "The user pi is using the default password. Refusing to activate SSH" - echo "SSH disabled" - return 1 + [[ "${SALT}" != "" ]] && { + local HASH=$(mkpasswd -msha-512 raspberry "$SALT") + grep -q "${HASH}" <<< "${SHADOW}" && { + systemctl stop ssh + systemctl disable ssh + echo "The user pi is using the default password. Refusing to activate SSH" + echo "SSH disabled" + return 1 + } } } @@ -68,14 +70,16 @@ configure() local SHADOW="$( grep -E '^root:' /etc/shadow )" test -n "${SHADOW}" && { local SALT=$(echo "${SHADOW}" | sed -n 's/root:\$6\$//;s/\$.*//p') - local HASH=$(mkpasswd -msha-512 1234 "$SALT") - grep -q "${HASH}" <<< "${SHADOW}" && { - systemctl stop ssh - systemctl disable ssh - echo "The user root is using the default password. Refusing to activate SSH" - echo "SSH disabled" - return 1 + [[ "${SALT}" != "" ]] && { + local HASH=$(mkpasswd -msha-512 1234 "$SALT") + grep -q "${HASH}" <<< "${SHADOW}" && { + systemctl stop ssh + systemctl disable ssh + echo "The user root is using the default password. Refusing to activate SSH" + echo "SSH disabled" + return 1 + } } } |