Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sudo command in skipper-entrypoint.sh #171

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading