Skip to content

Commit 49382c8

Browse files
committed
Fix sudo command in skipper-entrypoint.sh
1 parent e8d135f commit 49382c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

skipper/data/skipper-entrypoint.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ if ! [ -z "${SKIPPER_DOCKER_GID}" ];then
2828
usermod -G root ${SKIPPER_USERNAME}
2929
fi
3030

31-
if ! which sudo > /dev/null; then
32-
su -m ${SKIPPER_USERNAME} -c "$@"
33-
else
34-
# for debian dsitros (maybe for others too) -m flag resets the PATH variable
31+
if sudo -l -U ${SKIPPER_USERNAME} > /dev/null; then
32+
# for debian distros (maybe for others too) -m flag resets the PATH variable
3533
# so we need to use sudo -E to preserve the PATH
3634
sudo -sE -u ${SKIPPER_USERNAME} "$@"
35+
else
36+
su -m ${SKIPPER_USERNAME} -c "$@"
3737
fi
3838
else
3939
bash -c "$@"

0 commit comments

Comments
 (0)