# Error creating a new enrollment token

**URL:** <https://discuss.elastic.co/t/error-creating-a-new-enrollment-token/169320>\
**Category:** Beats\
**Tags:** fleet\
**Created:** [February 21, 2019, 4:22am UTC](https://discuss.elastic.co/t/error-creating-a-new-enrollment-token/169320 "2019-02-21T04:22:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [February 21, 2019, 5:54pm UTC](https://discuss.elastic.co/t/error-creating-a-new-enrollment-token/169320/3 "2019-02-21T17:54:55Z")

</div>

ok, still getting same security\_exception:

```
# ES_PWD=changeme
# filebeat enroll https://X.X.X:443 --username elastic --password env:ES_PWD
Error creating a new enrollment token: [security_exception] failed to authenticate user [elastic], with { header={ WWW-Authenticate="Basic realm=\"security\" charset=\"UTF-8\"" } }
# curl -s -I https://elastic:$ES_PWD@X.X.X:443 | grep ^HTTP
HTTP/1.1 200 OK
# 

```

yet, following works as expected:

```
# filebeat enroll https://X.X.X:443 --username elastic --password stdin
Enter password: 
This will replace your current settings. Do you want to continue? [Y/n]:y
Saving a copy of current settings to /etc/filebeat/filebeat.yml.bak
Enrolled and ready to retrieve settings from Kibana
#
```

---

_[View the full topic](https://discuss.elastic.co/t/error-creating-a-new-enrollment-token/169320)._
