# Kibana 4 won't start with elasticsearch creds in the config

**URL:** <https://discuss.elastic.co/t/kibana-4-wont-start-with-elasticsearch-creds-in-the-config/35197>\
**Category:** Kibana\
**Created:** [November 21, 2015, 1:36am UTC](https://discuss.elastic.co/t/kibana-4-wont-start-with-elasticsearch-creds-in-the-config/35197 "2015-11-21T01:36:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluethundr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bluethundr/32/409_2.png) [@bluethundr](https://discuss.elastic.co/u/bluethundr)\
**Post date:** [November 21, 2015, 1:36am UTC](https://discuss.elastic.co/t/kibana-4-wont-start-with-elasticsearch-creds-in-the-config/35197/1 "2015-11-21T01:36:49Z")

</div>

Guys,

It seems that kibana can't communicate with ES 2.0 with the Shield plugin installed.

I see this message in kibana instead of the logstash interface:

`plugin:elasticsearch Authentication Exception

So I consulted these docs to find out that I had to include some authentication parameters in the kibana config:

[Kibana Shield Docs](https://www.elastic.co/guide/en/shield/current/kibana.html)

And I added the credentiails to the bottom of the kibana.yml

elasticsearch.username: 'kibana4-server'  
elasticsearch.password: 'secret'

And after that, kibana won't restart! 😕

I've also tried specifying the credentials both with soft quotes (") and without quotes, and I get the same result!

```
[root@logs:/opt/kibana] #ps -ef |grep kibana | grep -v grep
[root@logs:/opt/kibana] #

[root@logs:/opt/kibana] #service kibana status
kibana is not running

```

This is literally all I have in my kibana.yml config:

```
#egrep -v "^$|^#" config/kibana.yml
 server.host: "localhost"
elasticsearch.username: 'kibana4-server'
elasticsearch.password: 'secret'

```

I can see this error in the kibana logs:

```
FATAL CLI ERROR YAMLException: end of the stream or a document separator is expected at line 78, column 1:
 elasticsearch.username: "kibana4 ...

at generateError (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:160:10)
at throwError (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:166:9)
at readDocument (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1498:5)
at loadDocuments (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1538:5)
at load (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1555:19)
at Object.safeLoad (/opt/kibana-4.2.1-linux-x64/node_modules/js-yaml/lib/js-yaml/loader.js:1573:10)
at module.exports (/opt/kibana-4.2.1-linux-x64/src/cli/serve/readYamlConfig.js:43:19)
at Command.callee$1$0$ (/opt/kibana-4.2.1-linux-x64/src/cli/serve/serve.js:66:22)
at tryCatch (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at invoke (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at enqueueResult (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:185:17)
at new Promise (/opt/kibana-4.2.1-linux-x64/node_modules/babel-core/node_modules/core-js/modules/es6.promise.js:197:7)
at Promise.exports.(anonymous function).target.(anonymous function).function.target.(anonymous function).F (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/node_modules/core-js/library/modules/$.export.js:30:36)
at AsyncIterator.enqueue (/opt/kibana-4.2.1-linux-x64/node_modules/babel-runtime/regenerator/runtime.js:184:16)

```

I think at this point that the only thing standing in the way of my using LS with Shield is Kibana!

I have to remove the ES credentials from the kibana config so Kibana will start up again. But then I'm stuck with the error: `plugin:elasticsearch Authentication Exception`

How can I specify the elasticsearch credentials in the kibana config without causing it to barf?

---

<div class="post-metadata">

**Author:** ![bluethundr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bluethundr/32/409_2.png) [@bluethundr](https://discuss.elastic.co/u/bluethundr)\
**Post date:** [November 21, 2015, 2:48am UTC](https://discuss.elastic.co/t/kibana-4-wont-start-with-elasticsearch-creds-in-the-config/35197/2 "2015-11-21T02:48:57Z")

</div>

Unbelievable! This was a yaml parsing issue. 😡

Turns out I had a couple spaces leading the server.host entry at the top of the file.

```
[root@logs:/opt/kibana] #egrep -v "^$|^#" config/kibana.yml
  server.host: "localhost"
elasticsearch.username: 'kibana4-server'
elasticsearch.password: 'secret'

```

Once I removed the spaces, kibana starts up fine. AND authenticates against shield!

```
[root@logs:/opt/kibana] #egrep -v "^$|^#" config/kibana.yml
server.host: "localhost"
elasticsearch.username: 'kibana4-server'
elasticsearch.password: 'secret'

```

But why kibana starts with the space at the beginning of server.host, before I add the elasticsearch parameters at the end, it beats me! Anyway, I seem to be on the right track at this point.

---

<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, 2:08pm UTC](https://discuss.elastic.co/t/kibana-4-wont-start-with-elasticsearch-creds-in-the-config/35197/3 "2017-07-06T14:08:37Z")

</div>


