From ff77fa24889406a5f31b1e6d260f67e442a8f816 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Fri, 13 Mar 2026 10:19:34 -0400 Subject: [PATCH] preserve env for root -> ubuntu user (#3495) --- scripts/cloud-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/cloud-entrypoint.sh b/scripts/cloud-entrypoint.sh index 8eb056acb..37105cd31 100755 --- a/scripts/cloud-entrypoint.sh +++ b/scripts/cloud-entrypoint.sh @@ -104,7 +104,7 @@ if [ "$JUPYTER_DISABLE" != "1" ]; then # Run Jupyter Lab as ubuntu user when possible JUPYTER_ARGS="--port=8888 --ip=* --ServerApp.allow_origin=*" if [ "$(id -u)" -eq 0 ] && id ubuntu &>/dev/null; then - sudo -u ubuntu bash -c "JUPYTER_TOKEN='$JUPYTER_TOKEN' jupyter lab $JUPYTER_ARGS" & + sudo --preserve-env=PATH,JUPYTER_TOKEN -u ubuntu jupyter lab $JUPYTER_ARGS & else if [ "$(id -u)" -eq 0 ]; then JUPYTER_ARGS="$JUPYTER_ARGS --allow-root" @@ -131,7 +131,7 @@ fi # Execute the passed arguments (CMD) as ubuntu when possible if [ "$(id -u)" -eq 0 ] && id ubuntu &>/dev/null; then - exec sudo -u ubuntu "$@" + exec sudo --preserve-env=PATH -u ubuntu "$@" else exec "$@" fi