# Native Authentication in ElasticSearch 2.3.4

**URL:** <https://discuss.elastic.co/t/native-authentication-in-elasticsearch-2-3-4/167570>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [February 8, 2019, 5:13am UTC](https://discuss.elastic.co/t/native-authentication-in-elasticsearch-2-3-4/167570 "2019-02-08T05:13:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkthetechie](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@jkthetechie](https://discuss.elastic.co/u/jkthetechie)\
**Post date:** [February 8, 2019, 5:13am UTC](https://discuss.elastic.co/t/native-authentication-in-elasticsearch-2-3-4/167570/1 "2019-02-08T05:13:57Z")

</div>

Hi, I am using ElasticSearch 2.3.4 version. Trying to implement native authentication in 2.3.4.

Have added the below configuration in elasticsearch.yml.  
shield:  
authc:  
realms:  
native1:  
type: native  
order: 0  
enabled: true  
And tried to create a user using the below POST rest call  
[http://localhost:9200/POST](http://localhost:9200/POST) /\_shield/user/ironman { "password" : "j@rV1s", ![](https://www.elastic.co/guide/en/shield/2.3/images/icons/callouts/1.png) "roles" : ["admin", "other\_role1"], ![](https://www.elastic.co/guide/en/shield/2.3/images/icons/callouts/2.png) "full\_name" : "Tony Stark", ![](https://www.elastic.co/guide/en/shield/2.3/images/icons/callouts/3.png) "email" : "tony@starkcorp.co", ![](https://www.elastic.co/guide/en/shield/2.3/images/icons/callouts/4.png) "metadata" : { ![](https://www.elastic.co/guide/en/shield/2.3/images/icons/callouts/5.png) "intelligence" : 7 } }

Was unable to create the user using the above call. I dont see any plugin in my plugins folder. Should there be any plugin for authentication or is that supported default?

Please help me on how to create a user and authenticate the calls.

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [February 8, 2019, 2:06pm UTC](https://discuss.elastic.co/t/native-authentication-in-elasticsearch-2-3-4/167570/2 "2019-02-08T14:06:09Z")

</div>

Hi there,

This is a very very old version of Elasticsearch. Can't you update or install version 6 instead ? [6.6.0](https://www.elastic.co/blog/elastic-stack-6-6-0-released) is the last released version.

In 2.3.4, you'd need to [install](https://www.elastic.co/guide/en/shield/2.3/installing-shield.html) and [configure](https://www.elastic.co/guide/en/shield/2.3/native-realm.html) the Shield plugin

---

<div class="post-metadata">

**Author:** ![jkthetechie](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@jkthetechie](https://discuss.elastic.co/u/jkthetechie)\
**Post date:** [February 12, 2019, 11:35am UTC](https://discuss.elastic.co/t/native-authentication-in-elasticsearch-2-3-4/167570/3 "2019-02-12T11:35:34Z")

</div>

Firstly, thanks for the reply.  
Have installed shield and license plugins and then created a user using the below command  
"bin/shield/esusers useradd username -r admin"

Using the below code creaing a connection and tried to access ElasticSearch. But the authentication is failing and getting the exception "The remote server returned an error: (401) Unauthorized"

IConnectionPool connectionPool = this.\_connectionPool.ToLower().Equals(staticConnectionPool) ? new StaticConnectionPool(nodes) : new SniffingConnectionPool(nodes);

ConnectionSettings connectionSettings = new ConnectionSettings(connectionPool).BasicAuthentication("es\_user","testpwd");

connectionSettings.ThrowExceptions(true);

ElasticClient client = new ElasticClient(connectionSettings);

Could you please help on what is missing here?

---

<div class="post-metadata">

**Author:** ![jkthetechie](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@jkthetechie](https://discuss.elastic.co/u/jkthetechie)\
**Post date:** [February 12, 2019, 12:52pm UTC](https://discuss.elastic.co/t/native-authentication-in-elasticsearch-2-3-4/167570/4 "2019-02-12T12:52:54Z")

</div>

It worked after I changed type to from 'native' to 'file' in the below configuration (elasticsearch.yml).

shield:  
authc:  
realms:  
file1:  
type: file  
order: 0

---

<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 12, 2019, 1:00pm UTC](https://discuss.elastic.co/t/native-authentication-in-elasticsearch-2-3-4/167570/5 "2019-03-12T13:00:42Z")

</div>

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