# 401 Unauthorized : unable to authenticate user when local metricbeats tries to connect to dockerized ELK

**URL:** <https://discuss.elastic.co/t/401-unauthorized-unable-to-authenticate-user-when-local-metricbeats-tries-to-connect-to-dockerized-elk/237551>\
**Category:** Elasticsearch\
**Created:** [June 18, 2020, 2:46am UTC](https://discuss.elastic.co/t/401-unauthorized-unable-to-authenticate-user-when-local-metricbeats-tries-to-connect-to-dockerized-elk/237551 "2020-06-18T02:46:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![drjosephliu](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@drjosephliu](https://discuss.elastic.co/u/drjosephliu)\
**Post date:** [June 18, 2020, 2:46am UTC](https://discuss.elastic.co/t/401-unauthorized-unable-to-authenticate-user-when-local-metricbeats-tries-to-connect-to-dockerized-elk/237551/1 "2020-06-18T02:46:29Z")

</div>

Hi, I'm very new to ELK and could really do with some help.

I've installed [dockerized ELK](https://github.com/deviantony/docker-elk) on my computer and started it up with default configuration using `docker-compose up -d`. The default config uses username _elastic_ and password _changeme_.

In addition, I've installed non-dockerized metricbeat on my local and set the metricbeat.yml file with the following:

```auto
metricbeat.modules:
- module: system
  metricsets:
    - cpu
    - filesystem
    - memory
    - network
    - process
  enabled: true
  period: 10s
  processes: ['.*']
  cpu_ticks: false

fields:
  env: dev

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
  user: "elastic:"
  password: "changeme"

```

and started it with the following command:  
`./metricbeat -e -c metricbeat.yml -d "publish"`

Despite setting the credentials in the metricbeat.yml file, I'm still getting the following error:

```auto
2020/06/18 02:44:21.914610 output.go:74: ERR Failed to connect: 401 Unauthorized: {"error":{"root_cause":[{"type":"security_exception","reason":"unable to authenticate user [] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"unable to authenticate user [] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

```

---

<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 16, 2020, 2:46am UTC](https://discuss.elastic.co/t/401-unauthorized-unable-to-authenticate-user-when-local-metricbeats-tries-to-connect-to-dockerized-elk/237551/2 "2020-07-16T02:46:30Z")

</div>

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