# Basic Authentication Issue

**URL:** <https://discuss.elastic.co/t/basic-authentication-issue/57528>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [August 8, 2016, 9:05pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528 "2016-08-08T21:05:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahinera](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sahinera](https://discuss.elastic.co/u/sahinera)\
**Post date:** [August 8, 2016, 9:05pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/1 "2016-08-08T21:05:18Z")

</div>

Hi all,

I am trying to set up Shield on a server, and am following the tutorial on the Elasticsearch website. After installing Shield as instructed, I ran:

> bin/shield/esusers useradd es\_admin -r admin

and entered a password. Now, I try to use this username-password combination with:

> curl -u es\_admin -XGET '[http://localhost:9200/](http://localhost:9200/)'

but am still rejected, the reason being "unable to authenticate user [es\_admin] for REST request [/]", even though I know the password I enter is correct.

For reference, I have Elasticsearch 2.3.3 installed in my /opt/ folder. I have seen some threads where people's problems have been solved by moving ES\_HOME/config/shield to /etc/elasticsearch/, but this has not helped me. My users and users\_roles files in said shield folder seem to indicate that there is a user named es\_admin with admin permissions, so I don't see what is going on here. Any help is appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)\
**Post date:** [August 9, 2016, 11:29pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/2 "2016-08-09T23:29:54Z")

</div>

How did you install elasticsearch? Did you use a rpm or deb install?

---

<div class="post-metadata">

**Author:** ![sahinera](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sahinera](https://discuss.elastic.co/u/sahinera)\
**Post date:** [August 10, 2016, 1:13pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/3 "2016-08-10T13:13:37Z")

</div>

I installed using RPM

---

<div class="post-metadata">

**Author:** ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)\
**Post date:** [August 10, 2016, 5:30pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/4 "2016-08-10T17:30:24Z")

</div>

Did you modify the configuration directory or anything like that? If you go to your configuration directory does the `shield` folder exist?

---

<div class="post-metadata">

**Author:** ![sahinera](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sahinera](https://discuss.elastic.co/u/sahinera)\
**Post date:** [August 10, 2016, 6:38pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/5 "2016-08-10T18:38:51Z")

</div>

I did not modify it; the shield folder exists but whenever I add a user with the command described above, it does not update the users or users\_roles file with any new information.

---

<div class="post-metadata">

**Author:** ![sahinera](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sahinera](https://discuss.elastic.co/u/sahinera)\
**Post date:** [August 10, 2016, 7:08pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/6 "2016-08-10T19:08:53Z")

</div>

Okay, this kind of working now for some reason. Not exactly sure what happened or changed... I just recopied /etc/elasticsearch/shield into my config folder (/opt/elasticsearch-2.3.3/config/), and then got some error about not being able to access config files. Then in elasticsearch.yml, I explicitly set path.conf: /etc/elasticsearch/.

Now, the users defined in both /opt/elasticsearch-2.3.3/config/shield/users and /etc/elasticsearch/shield/users are able to be authenticated by shield. However, if I try to add a new user using the "useradd" command, only /etc/elasticsearch/shield/users updates, and this new user isn't recognized.

---

<div class="post-metadata">

**Author:** ![sahinera](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sahinera](https://discuss.elastic.co/u/sahinera)\
**Post date:** [August 10, 2016, 7:38pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/7 "2016-08-10T19:38:48Z")

</div>

Now I deleted the config folder entirely from /opt/elasticsearch-2.3.3/config/shield/users, and everything works fine! I am able to add new users and access the protected Elasticsearch URL. I guess changing the path.conf in elasticsearch.yml is what did the trick?

---

<div class="post-metadata">

**Author:** ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)\
**Post date:** [August 10, 2016, 8:15pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/8 "2016-08-10T20:15:09Z")

</div>

What RPM did you install? The official one does not install in `/opt`. By default for a RPM install, Shield will expect the config directory to be /etc/elasticsearch

---

<div class="post-metadata">

**Author:** ![sahinera](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sahinera](https://discuss.elastic.co/u/sahinera)\
**Post date:** [August 10, 2016, 8:18pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/9 "2016-08-10T20:18:27Z")

</div>

I believe I installed the default, but then moved it to /opt/ for some reason at some point. I see now that I shouldn't have done that.

---

<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:** [July 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/basic-authentication-issue/57528/10 "2017-07-06T13:42:24Z")

</div>


