user SUDO_USER variable for adding to ssh group

This commit is contained in:
Aaron Murray 2022-08-16 19:25:58 -05:00
parent 27e369c6ce
commit df757ed6dd

10
install
View File

@ -13,7 +13,7 @@
# https://github.com/armbian/config/blob/master/debian-software # https://github.com/armbian/config/blob/master/debian-software
# https://forum.openmediavault.org/index.php/Thread/25062-Install-OMV5-on-Debian-10-Buster/ # 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 if [[ $(id -u) -ne 0 ]]; then
@ -500,10 +500,10 @@ if getent passwd pi > /dev/null; then
fi fi
# add user running the script to ssh group if not pi or root # add user running the script to ssh group if not pi or root
if [ -n "${USER}" ] && [ ! "${USER}" = "root" ] && [ ! "${USER}" = "pi" ]; then if [ -n "${SUDO_USER}" ] && [ ! "${SUDO_USER}" = "root" ] && [ ! "${SUDO_USER}" = "pi" ]; then
if getent passwd ${USER} > /dev/null; then if getent passwd ${SUDO_USER} > /dev/null; then
echo "Adding ${USER} to the ssh group ..." echo "Adding ${SUDO_USER} to the ssh group ..."
usermod -a -G ssh ${USER} usermod -a -G ssh ${SUDO_USER}
fi fi
fi fi