From df757ed6ddb790a00dd5c3070bc9476e97c235fe Mon Sep 17 00:00:00 2001 From: Aaron Murray Date: Tue, 16 Aug 2022 19:25:58 -0500 Subject: [PATCH] user SUDO_USER variable for adding to ssh group --- install | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install b/install index dc29768..b579a96 100755 --- a/install +++ b/install @@ -13,7 +13,7 @@ # https://github.com/armbian/config/blob/master/debian-software # https://forum.openmediavault.org/index.php/Thread/25062-Install-OMV5-on-Debian-10-Buster/ # -# version: 1.6.18 +# version: 1.6.19 # if [[ $(id -u) -ne 0 ]]; then @@ -500,10 +500,10 @@ if getent passwd pi > /dev/null; then fi # add user running the script to ssh group if not pi or root -if [ -n "${USER}" ] && [ ! "${USER}" = "root" ] && [ ! "${USER}" = "pi" ]; then - if getent passwd ${USER} > /dev/null; then - echo "Adding ${USER} to the ssh group ..." - usermod -a -G ssh ${USER} +if [ -n "${SUDO_USER}" ] && [ ! "${SUDO_USER}" = "root" ] && [ ! "${SUDO_USER}" = "pi" ]; then + if getent passwd ${SUDO_USER} > /dev/null; then + echo "Adding ${SUDO_USER} to the ssh group ..." + usermod -a -G ssh ${SUDO_USER} fi fi