# 401 Unauthorized

**URL:** https://discuss.elastic.co/t/401-unauthorized/118943
**Category:** Elasticsearch
**Created:** [February 7, 2018, 11:38pm UTC](https://discuss.elastic.co/t/401-unauthorized/118943 "2018-02-07T23:38:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jamest23](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jamest23](https://discuss.elastic.co/u/jamest23)
#### Post date: [February 7, 2018, 11:38pm UTC](https://discuss.elastic.co/t/401-unauthorized/118943/1 "2018-02-07T23:38:10Z")

</div>

I upgraded to 6.2 installed x-pack and i can't seem to find the cause.  
I have installed ELK many times-- I must have missed a config parameter.  
It is all running on the same machine.

logstash cant connect

> :error=\>"Got response code '401' contacting Elasticsearch at URL '[http://localhost:9200/](http://localhost:9200/)

curl cant connect  
I try and list the indices and i get  
curl -XGET 'localhost:9200/\_cat/indices?v&pretty'  
{  
"error" : {  
"root\_cause" : [  
{  
"type" : "security\_exception",  
"reason" : "missing authentication token for REST request [/\_cat/indices?v&pretty]",  
"header" : {  
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""  
}  
}  
],  
"type" : "security\_exception",  
"reason" : "missing authentication token for REST request [/\_cat/indices?v&pretty]",  
"header" : {  
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""  
}  
},  
"status" : 401

---

<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: [February 8, 2018, 3:13am UTC](https://discuss.elastic.co/t/401-unauthorized/118943/2 "2018-02-08T03:13:17Z")

</div>

X-Pack includes Security which is on by default (depending on your license type).

By default you get a 30 day trial license with all features enabled (including security), and so, by default your ES server is not accessible without a username + password.

Your options are:

- Register for the Basic license at [https://register.elastic.co/](https://register.elastic.co/). That will give you a free license to a bunch of X-Pack features like Monitoring, APM, reporting, dev tools, and will automatically disable security. See [https://www.elastic.co/subscriptions](https://www.elastic.co/subscriptions)
- Keep running with a trial license, but disable security by adding

```auto
xpack.security.enabled: false 

```

to your `elasticsearch.yml` configuration file.
- Keep running with a trial license, and make use of security by providing a username and password for each request. This is a simple configuration in logstash, and requires some small setup on the ES side. See [https://www.elastic.co/guide/en/x-pack/6.1/setting-up-authentication.html](https://www.elastic.co/guide/en/x-pack/6.1/setting-up-authentication.html)
- Remove X-Pack (but I hope you don't do that, the free license includes a lot of useful features, even if you don't want security).

---

<div class="post-metadata">

### Author: ![jamest23](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jamest23](https://discuss.elastic.co/u/jamest23)
#### Post date: [February 8, 2018, 3:18am UTC](https://discuss.elastic.co/t/401-unauthorized/118943/3 "2018-02-08T03:18:49Z")

</div>

Thanks.  
Yes, i found an example.  
I put user/passwd fields in my outputs

Works great.

---

<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: [March 8, 2018, 3:18am UTC](https://discuss.elastic.co/t/401-unauthorized/118943/4 "2018-03-08T03:18:57Z")

</div>

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