diff --git a/scripts/config-merger.sh b/scripts/config-merger.sh index 264dfed..d8b74a0 100755 --- a/scripts/config-merger.sh +++ b/scripts/config-merger.sh @@ -23,8 +23,10 @@ NODE_ROLES=${NODE_ROLES:-""} # Make a list of roles IFS=',' read -ra ROLES <<<"$NODE_ROLES" -echo "changing the ownership of data folder: /usr/share/opensearch/data" -chown -R "$ELASTICSEARCH_UID":"$ELASTICSEARCH_UID" /usr/share/opensearch/data +if [[ "$(id -u)" == "0" ]]; then + echo "changing the ownership of data folder: /usr/share/opensearch/data" + chown -R "$ELASTICSEARCH_UID":"$ELASTICSEARCH_UID" /usr/share/opensearch/data +fi # load default config files to config directory cp -f -R $DEFAULT_CONFIG_DIR/* $CONFIG_DIR @@ -103,9 +105,6 @@ for FILE_DIR in "$CONFIG_DIR"/*; do fi done fi - - # restore original file permission - chmod "$ORIGINAL_PERMISSION" "$FILE_DIR" done ##-------------------------------OpenSearch---------------------------------- @@ -191,8 +190,5 @@ if [ -d $SECURITY_CONFIG_DIR ]; then fi done fi - - # restore original file permission - chmod "$ORIGINAL_PERMISSION" "$FILE_DIR" done fi diff --git a/scripts/dashboard-config-merger.sh b/scripts/dashboard-config-merger.sh index 2e142d7..47d2bce 100755 --- a/scripts/dashboard-config-merger.sh +++ b/scripts/dashboard-config-merger.sh @@ -55,6 +55,4 @@ for FILE_DIR in "$CONFIG_DIR"/*; do fi - # restore original file permission - chmod "$ORIGINAL_PERMISSION" "$FILE_DIR" done \ No newline at end of file