diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 448c872ec11..41f594da55c 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -210,6 +210,9 @@ Bug Fixes * SOLR-13954: Embedded ZooKeeper in Solr now does not try to load JettyAdminServer (janhoy) +* SOLR-13087: Use EUID instead of whoami to check for root in the bin/solr script (Martijn Koster via Jason Gerlowski) + + Other Changes --------------------- diff --git a/solr/bin/solr b/solr/bin/solr index 4b6236537bf..9a5a4a21187 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -1141,7 +1141,7 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM echo " To turn off: bin/solr config -c $CREATE_NAME -p $CREATE_PORT -action set-user-property -property update.autoCreateFields -value false" fi - if [[ "$(whoami)" == "root" ]] && [[ "$FORCE" == "false" ]] ; then + if [[ $EUID -eq 0 ]] && [[ "$FORCE" == "false" ]] ; then echo "WARNING: Creating cores as the root user can cause Solr to fail and is not advisable. Exiting." echo " If you started Solr as root (not advisable either), force core creation by adding argument -force" exit 1 @@ -1877,7 +1877,7 @@ if [ -z "$STOP_PORT" ]; then fi if [ "$SCRIPT_CMD" == "start" ] || [ "$SCRIPT_CMD" == "restart" ] ; then - if [[ "$(whoami)" == "root" ]] && [[ "$FORCE" == "false" ]] ; then + if [[ $EUID -eq 0 ]] && [[ "$FORCE" == "false" ]] ; then echo "WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting." echo " Please consult the Reference Guide. To override this check, start with argument '-force'" exit 1