# Elasticsearch: Couldn't login as the user Elastic

**URL:** <https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335>\
**Category:** Elasticsearch\
**Created:** [July 3, 2018, 8:34am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335 "2018-07-03T08:34:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Preethi](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Preethi](https://discuss.elastic.co/u/Preethi)\
**Post date:** [July 3, 2018, 8:34am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335/1 "2018-07-03T08:34:50Z")

</div>

Hi,  
Since I need teh login page for Kibana, I enabled the xpack.security.enable: true in kibana.yml and added elasticsearc.username: "some\_username" and elasticsearch.password: "some\_pwd"

After restarting Elasticsearch and kibana, It didn't show the login page for Kibana.

Then I added this pack.security.enabeld: true in elasticsearch.yml file. Then I got the login page in kibana UI also. But its was disabled.

Noticed that teh elasticsearch needs to be logged in. So i logged in as teh user "elastic".

But I got below log:

[INFO][o.e.x.s.a.AuthenticationService] [E7h8aKO] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]

So I followed the steps in this thread.

> [@I lost the password that has been changed](https://discuss.elastic.co/t/i-lost-the-password-that-has-been-changed/91867/2):
>
> Note: These instructions are quite old. Newer instructions are available here [X-Pack Authentication issue](https://discuss.elastic.co/t/x-pack-authentication-issue/121632/7) It is possible to reset the elastic user password (see below) but from your description, it doesn't sound like this is necessarily what you need. The elastic user is a superuser. We don't recommend using it for any purpose other than administering the system. In particular, Kibana should not connect to Elasticsearch using the elastic user - by default it uses the kibana user, so the p…

But I am getting below error now. How to fixe it?

admin$ curl -u my\_admin -XPUT '[http://localhost:9200/\_xpack/security/user/elastic/\_password?pretty](http://localhost:9200/_xpack/security/user/elastic/_password?pretty)' -H 'Content-Type: application/json' -d'  
{  
"password" : "myadmin"  
}'  
Enter host password for user 'my\_admin':  
{  
"error" : {  
"root\_cause" : [  
{  
"type" : "security\_exception",  
"reason" : "unable to authenticate user [my\_admin] for REST request [/\_xpack/security/user/elastic/\_password?pretty]",  
"header" : {  
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""  
}  
}  
],  
"type" : "security\_exception",  
"reason" : "unable to authenticate user [my\_admin] for REST request [/\_xpack/security/user/elastic/\_password?pretty]",  
"header" : {  
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""  
}  
},  
"status" : 401  
}

Thanks

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 9, 2018, 2:12am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335/2 "2018-07-09T02:12:27Z")

</div>

> [@Preethi](#):
>
> But I am getting below error now. How to fixe it?

Enter the correct password?

> ```auto
> "reason" : "unable to authenticate user [my_admin] for REST request [/_xpack/security/user/elastic/_password?pretty]",
> 
> ```

This means that the password you entered is not valid for the my\_admin user. Since you haven't provided any details about the steps you went through to setup that user, it's impossible for us to tell you what's gone wrong.

---

<div class="post-metadata">

**Author:** ![Preethi](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Preethi](https://discuss.elastic.co/u/Preethi)\
**Post date:** [July 9, 2018, 6:48am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335/3 "2018-07-09T06:48:43Z")

</div>

Yes, When I tried teh default username and password for elasticsearch. It didn't clear through.  
So I tried to create a new superuser. It also gave me the same error.

I enbled the xpack.security.enabeld: true in elasticsearch.yml file. After that only elastic search started prompting username and password.

Why I tried to do this is to get the login page in Kibana UI.

Below is the issue:

Hi,  
Referred the video in this URL to set up the login account for Kibana UI(Version 6.3.0).  
[https://www.elastic.co/webinars/getting-started-kibana](https://www.elastic.co/webinars/getting-started-kibana) 1

I installed Kibana 6.3.0, but not X-pack separately. Since its not required for this version of Kibana.

In the above video, he installed the x-pack plugin using this command, bin/kibana-plugin install x-pack . If I run the command in terminal, It gave me this message  
"Kibana now contains X-Pack by default, there is no longer any need to install it as it is already present.".  
Does it mean that no need to install x-pack for Kibana 6.3.0? or Still need to install separately something like this in this guide?  
[https://www.elastic.co/guide/en/kibana/5.6/installing-xpack-kb.html](https://www.elastic.co/guide/en/kibana/5.6/installing-xpack-kb.html)

As mentioned in the demo,  
enabled the elasticserach.username : "user"  
elasticserach.password: "pass"

This was the one, when I saw the kibana.yml file.

After I start the cabin service using this command, bin/kibana the Kibana doesn't prompt for any username or password, directly teh home page loaded.

Am I missing any other setting in configuration files?

Can clarify what's wrong in the steps I did?

Thanks

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 9, 2018, 7:13am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335/4 "2018-07-09T07:13:46Z")

</div>

Ignore Kibana. Let's get Elasticsearch working, and then we can worry about Kibana.

> [@Preethi](#):
>
> Yes, When I tried teh default username and password for elasticsearch. It didn't clear through.  
> So I tried to create a new superuser. It also gave me the same error.

You need to give us a lot more detail than that.

- What _exactly_ did you try? Be as specific as you can. If you ran a command tell us exactly what you ran.
- What "default username and password" are you referring to? Elasticsearch doesn't have a default username and password, so what _exactly_ do you mean here?
- What does "it didn't clear through" mean? Did you get an error? what was the error?
- _"I tried to create a new superuser"_ What are the _exact_ step that you took? If possible copy-and-paste the commands from your terminal.
- _"It also gave me the same error."_ What error?

---

<div class="post-metadata">

**Author:** ![Preethi](https://avatars.discourse-cdn.com/v4/letter/p/f04885/32.png) [@Preethi](https://discuss.elastic.co/u/Preethi)\
**Post date:** [July 10, 2018, 2:18am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335/5 "2018-07-10T02:18:36Z")

</div>

I added the below setting in elasticserach.yml file  
xpack.security.enadled: true

Added below setting in kibana.yml  
xpack.security.enadled: true

Removed the # symbol from settings in kibana.yml:  
elasticsearch.username: "some\_username"  
elasticserach.password: "some\_pwd"

So after start the elastic search service, while connecting to localhost:9200, It prompted for username and password.

entered the username "elastic" and password as "changeme". Found in some article that this is the default useraname and password. So used that to login. But I can't login using that user credential. Got below error in elasticsearch console  
"[INFO][o.e.x.s.a.AuthenticationService] [E7h8aKO] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]"

If there is no default username and password for elastic search, then how to login elasticsearch?

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 10, 2018, 2:46am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335/6 "2018-07-10T02:46:11Z")

</div>

> [@Preethi](#):
>
> entered the username "elastic" and password as "changeme". Found in some article that this is the default useraname and password.

This is why you need to be specific when you try and describe a problem, your original post skipped over these very basic facts that are critical to working through your problem.

You shouldn't just follow "some article" that you found. I don't know what you were reading, but it was clearly for an old version of Elasticsearch and isn't relevant to your version.

You should read the official docs for the version that you're running:

- [Getting started with security | Elasticsearch Guide [6.3] | Elastic](https://www.elastic.co/guide/en/elastic-stack-overview/6.3/security-getting-started.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 7, 2018, 2:46am UTC](https://discuss.elastic.co/t/elasticsearch-couldnt-login-as-the-user-elastic/138335/7 "2018-08-07T02:46:13Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
