diff --git a/besu/src/main/scripts/besu-entry.sh b/besu/src/main/scripts/besu-entry.sh index ed3687b2291..f79a1af14f7 100755 --- a/besu/src/main/scripts/besu-entry.sh +++ b/besu/src/main/scripts/besu-entry.sh @@ -45,5 +45,10 @@ done # Construct the command as a single string COMMAND="/opt/besu/bin/besu $@" -# Switch to the besu user and execute the command -exec su -s /bin/bash $BESU_USER_NAME -c "$COMMAND" +# Check if current user is root +if [ "$(id -u)" -eq 0 ]; then + # Switch to the besu user and execute the command + exec su -s /bin/bash "$BESU_USER_NAME" -c "$COMMAND" +else + exec /bin/bash -c "$COMMAND" +fi