From 7bfd864a47c5f283386fe042746a47dc0b3bb8da Mon Sep 17 00:00:00 2001 From: Aaron Murray Date: Fri, 2 Oct 2020 08:31:30 -0500 Subject: [PATCH] add user running script to ssh group --- install | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install b/install index 30a7fdb..547282d 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.2.7 +# version: 1.2.8 # if [[ $(id -u) -ne 0 ]]; then @@ -401,11 +401,20 @@ cat << EOF > ${ioniceCron} EOF chmod 600 ${ioniceCron} +# add pi user to ssh group if it exists if getent passwd pi > /dev/null; then echo "Adding pi user to ssh group ..." usermod -a -G ssh pi 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} + fi +fi + # remove networkmanager and dhcpcd5 then configure networkd if [ ${version} -gt 4 ] && [ ${skipNet} -ne 1 ]; then