diff --git a/skipper/data/skipper-entrypoint.sh b/skipper/data/skipper-entrypoint.sh index ee7e823..4423812 100755 --- a/skipper/data/skipper-entrypoint.sh +++ b/skipper/data/skipper-entrypoint.sh @@ -28,12 +28,12 @@ if ! [ -z "${SKIPPER_DOCKER_GID}" ];then usermod -G root ${SKIPPER_USERNAME} fi - if ! which sudo > /dev/null; then - su -m ${SKIPPER_USERNAME} -c "$@" - else - # for debian dsitros (maybe for others too) -m flag resets the PATH variable + if sudo -l -U ${SKIPPER_USERNAME} > /dev/null; then + # for debian distros (maybe for others too) -m flag resets the PATH variable # so we need to use sudo -E to preserve the PATH sudo -sE -u ${SKIPPER_USERNAME} "$@" + else + su -m ${SKIPPER_USERNAME} -c "$@" fi else bash -c "$@"