From 7b178a53ef99504f94c184b1630468cfd6b2b010 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Wed, 3 May 2023 18:30:07 -0700 Subject: [PATCH] only exec if calling user is root --- scripts/host-env | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/host-env b/scripts/host-env index 463977a..159136d 100755 --- a/scripts/host-env +++ b/scripts/host-env @@ -7,7 +7,7 @@ user=${USER:-"build"} export HOME="/home/${user}" # If running user is not root, pivot to custom user/group -[ "$uid" != "0" ] && { +if [ "$uid" != "0" ]; then getent group "$gid" \ && groupdel "$(awk -v i="$gid" -F: '$3 == i' /etc/group | cut -d: -f1)" getent passwd "$uid" \ @@ -21,8 +21,6 @@ export HOME="/home/${user}" -s /bin/bash \ "${user}" setpriv --reuid="$uid" --regid="$gid" --init-groups "$@" -} - -exec "$@" - - +else + exec "$@" +fi