Remove exec using su to change user.

This commit is contained in:
Darren 'Tadgy' Austin 2021-01-24 14:12:00 +00:00
commit 99279936b8

View file

@ -542,14 +542,12 @@ TEMPLATE="$2"
# Apply user and setting. # Apply user and setting.
[[ -n "$RUNAS_USER" ]] && { [[ -n "$RUNAS_USER" ]] && {
SUDO="$(command -v sudo)" SUDO="$(command -v sudox)"
SU="$(command -v su)"
if [[ -n "$SUDO" ]]; then if [[ -n "$SUDO" ]]; then
exec "$SUDO" -b -u "$RUNAS_USER" -- "$0" "${ORIG_ARGS[@]}" "$BASEDIR" "$TEMPLATE" exec "$SUDO" -b -u "$RUNAS_USER" -- "$0" "${ORIG_ARGS[@]}" "$BASEDIR" "$TEMPLATE" || die "failed to exec to change user"
else else
exec -a "su" "$SU" - "$RUNAS_USER" -- "$0" "${ORIG_ARGS[@]}" "$BASEDIR" "$TEMPLATE" die "cannot exec to change user: sudo not found"
fi fi
die "failed to exec to change user"
} }
# If input is to be a pipe/FIFO, open it. # If input is to be a pipe/FIFO, open it.