Skip to content

Commit

Permalink
Fix sudo command in skipper-entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
khizunov committed Feb 4, 2024
1 parent e8d135f commit b75d98d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions skipper/data/skipper-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
Expand Down

0 comments on commit b75d98d

Please sign in to comment.