0

I had generated passwords for elastic search using below command and I forgot to copy and backup passwords shown at console output

sudo -E ./elasticsearch-setup-passwords auto

When I tried executing it again , I am not able to regenerate passwords again, please help me in taking those passwords or guide me how to change password for user elastic

2 Answers 2

4

If you are not able to login kibana due to password not working and authentication error please use below process

  1. Stop elasticsearch
  2. Go to directory elasticsearch/bin
  3. Create new super user via below

./elasticsearch-users useradd elasticadmin -p elasticadmin -r superuser

  1. Start elasticsearch process

  2. Try running below command with new user you should get user list:

curl -u elasticadmin -XGET 'http://localhost:9200/_xpack/security/user?pretty'

Enter host password for user 'newadmin':

{ "elastic" : { "username" : "elastic", "roles" : [ "superuser" ], "full_name" : null, "email" : null, "metadata" : { "_reserved" : true }, "enabled" : true }, "kibana" : { "username" : "kibana", "roles" : [ "kibana_system" ], "full_name" : null,

  1. Run below curl command to change password of elastic user.

curl --user elasticadmin:#l@$t!c@dm!n -XPUT "http://localhost:9200/_xpack/security/user/elastic/_password?pretty" -H 'Content-Type: application/json' -d'{ "password" : "typeyourpasswordhere"}'

  1. Try login elasticsearch with new password of elastic user

curl -u elastic -XGET "http://localhost:9200/"

  1. In the similar way you can change password of kibana or other users as well
2

From the official documentation:

The elasticsearch-setup-passwords command uses a transient bootstrap password that is no longer valid after the command runs successfully. You cannot run the elasticsearch-setup-passwords command a second time. Instead, you can update passwords from the Management > Users UI in Kibana or use the security user API.

As stated in the part in bold, you can simply update the passwords from the Kibana UI.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.