4

I did the change in config/elasticsearch.yml to

xpack.security.enabled: true

And now after starting elasticsearch (./bin/elasticsearch) and then do: curl localhost:9200

getting:

{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

Then tried these 2:

curl localhost:9200 -u elastic:elastic
curl localhost:9200 -u elastic:changeme

getting:

{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]",
"header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}], "type":"security_exception", "reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}%

What is the default username/password for Elasticsearch 7.2.0?

Joe
  • 11,983
  • 31
  • 109
  • 183

1 Answers1

7

You need to use elasticsearch-setup-passwords util to generate/set password for the inbuilt user of elastic.

To setup password you can use either one of the following commands:

bin/elasticsearch-setup-passwords interactive

bin/elasticsearch-setup-passwords auto

The interactive parameter prompts new password for the users, whereas auto generates them for you.

elastic user is the superuser for elastic-cluster.

Read more one configuring security here.

Nishant
  • 7,504
  • 1
  • 21
  • 34
  • How can I script that (ansible) ? I want to be able to install and set my username and password without any screen interaction. – Joe Jul 09 '19 at 14:53
  • It has an auto and an interactive mode, so you should be able to automate it – xeraa Jul 09 '19 at 22:16