From 2aa0e8f0d48d0c6cae0989bfbff717c21c48e199 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Wed, 27 Jun 2018 17:46:18 +0200 Subject: SSH: fix root password in Raspbian --- changelog.md | 4 +++- etc/ncp-config.d/SSH.sh | 32 ++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/changelog.md b/changelog.md index 3fb06e63..c3057a0a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ -[v0.57.15](https://github.com/nextcloud/nextcloudpi/commit/164b5cd) (2018-06-26) nc-automount: fix udiskie not installed in latest image +[v0.57.16](https://github.com/nextcloud/nextcloudpi/commit/cf3dbf8) (2018-06-27) SSH: fix root password in Raspbian + +[v0.57.15](https://github.com/nextcloud/nextcloudpi/commit/c329280) (2018-06-26) nc-automount: fix udiskie not installed in latest image [v0.57.14](https://github.com/nextcloud/nextcloudpi/commit/16af06f) (2018-06-26) added database dir to ncp-info (#553) 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 + } } } -- cgit v1.2.3