Skip to content

Commit ff77fa2

Browse files
authored
preserve env for root -> ubuntu user (#3495)
1 parent e1ff756 commit ff77fa2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/cloud-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ if [ "$JUPYTER_DISABLE" != "1" ]; then
104104
# Run Jupyter Lab as ubuntu user when possible
105105
JUPYTER_ARGS="--port=8888 --ip=* --ServerApp.allow_origin=*"
106106
if [ "$(id -u)" -eq 0 ] && id ubuntu &>/dev/null; then
107-
sudo -u ubuntu bash -c "JUPYTER_TOKEN='$JUPYTER_TOKEN' jupyter lab $JUPYTER_ARGS" &
107+
sudo --preserve-env=PATH,JUPYTER_TOKEN -u ubuntu jupyter lab $JUPYTER_ARGS &
108108
else
109109
if [ "$(id -u)" -eq 0 ]; then
110110
JUPYTER_ARGS="$JUPYTER_ARGS --allow-root"
@@ -131,7 +131,7 @@ fi
131131

132132
# Execute the passed arguments (CMD) as ubuntu when possible
133133
if [ "$(id -u)" -eq 0 ] && id ubuntu &>/dev/null; then
134-
exec sudo -u ubuntu "$@"
134+
exec sudo --preserve-env=PATH -u ubuntu "$@"
135135
else
136136
exec "$@"
137137
fi

0 commit comments

Comments
 (0)