Vaibhav Yalla
Vaibhav Yalla

Reputation: 35

Elasticsearch_Installation_asking for username and password

After installation of Elasticsearch and running the elasticsearch.bat command. I need to check in https:localhost9200. Here I am getting a prompt asking for username and password.

Is there any default username or password???

Upvotes: 3

Views: 9637

Answers (4)

Batman Rises
Batman Rises

Reputation: 766

According to the elasticsearch 8 documentation auto/interactive is depricated. Instead we will be using the following command for setting the elasticsearch password.

elasticsearch-reset-password -u elastic --interactive

enter image description here

Upvotes: 0

Vishal Thakur
Vishal Thakur

Reputation: 1696

For Windows:-

Go to C:\xampp\htdocs\elasticsearch-8.2.2\bin folder.

under the above folder or path open the PowerShell terminal.

Now run this command : .\elasticsearch-reset-password -u elastic .

NOTE - don't forget to add dott (.) at the last.

Then you will see the reset password on the terminal, so now the browser login details will be -

username - elastic     // default username
password - new generated token/password

See the Screenshot for reference -

enter image description here

Read More Here:

1-> https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-windows.html#windows-service

2-> https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-users.html

Upvotes: 4

Amit
Amit

Reputation: 32376

Answer written by @harshit is correct, Adding more information so that it would be more helpful to the users running ES from code or want more context.

When you run it with source there is default username/password(applicable even in the ES 8.0) as mentioned in the ES code contribution guide and elastic is the default username and password is the default password.

Note that, from ES 8.0 even in Basic and trial ES version x-pack security is enabled by default, and it was disabled before ES 8.0. So if you want to disable it you need to add below setting to your elasticsearch.yml and restart ES.(Not recommended though)

xpack.security.enabled: false

Also, elastic is a reserved username in Elasticsearch, and when you install ES from an archive on *nix based system, its password is not generated due to known issue, but if you running it on Docker or on Windows it would be generated and password will be printed in the cluster logs as explained in official doc, where ES advises to store it in secure location.

Upvotes: 3

Harshit Gohil
Harshit Gohil

Reputation: 61

You can Generate a new password using

/usr/share/elasticsearch/elasticsearch-setup-passwords auto/interactive

interactive is where you will have to enter password for all user.

auto will just print passwords on the shell.

else

You can turn off x-pack security in elasticsearch.yml

Upvotes: 6

Related Questions