# Can't setup roles with active directory

**URL:** https://discuss.elastic.co/t/cant-setup-roles-with-active-directory/111543
**Category:** Elasticsearch
**Created:** [December 13, 2017, 11:00am UTC](https://discuss.elastic.co/t/cant-setup-roles-with-active-directory/111543 "2017-12-13T11:00:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Arthur\_Silva\_Sens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arthur_silva_sens/32/24913_2.png) [@Arthur\_Silva\_Sens](https://discuss.elastic.co/u/Arthur_Silva_Sens)
#### Post date: [December 13, 2017, 11:00am UTC](https://discuss.elastic.co/t/cant-setup-roles-with-active-directory/111543/1 "2017-12-13T11:00:45Z")

</div>

Greetings,

I am trying to give the superuser role to my user, but I'm failing miserably.

When I try:  
`curl 'localhost:9200' -u myuser`

I get the response:  
'  
{  
"error" : {  
"root\_cause" : [  
{  
"type" : "security\_exception",  
"reason" : "action [cluster:monitor/main] is unauthorized for user [_myuser_]"  
}  
],  
"type" : "security\_exception",  
"reason" : "action [cluster:monitor/main] is unauthorized for user [_myuser_]"  
},  
"status" : 403  
}  
'

So I know my active group is configured, it's just that my user don't have the correct permissions  
But when I try:  
`x-pack/users roles myuser -a superuser`

I get the response:  
ERROR: User [_myuser_] doesn't exist

Does anyone know how do I give the superuser role to my active group user?

Thanks in advance.

Edit: Sorry for the code formatting, I'm still a newbie with this forum

---

<div class="post-metadata">

### Author: ![Arthur\_Silva\_Sens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arthur_silva_sens/32/24913_2.png) [@Arthur\_Silva\_Sens](https://discuss.elastic.co/u/Arthur_Silva_Sens)
#### Post date: [December 13, 2017, 11:19am UTC](https://discuss.elastic.co/t/cant-setup-roles-with-active-directory/111543/2 "2017-12-13T11:19:27Z")

</div>

Hello there,

I solved my own problem haha

If anyone is having the same problem  
I've edited my _x-pack/roles\_mapping.yml_ file with

```
superuser:
  - "cn=myuser, dc=example, dc=com"

```

And it works fine now!

---

<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: [December 13, 2017, 11:37am UTC](https://discuss.elastic.co/t/cant-setup-roles-with-active-directory/111543/3 "2017-12-13T11:37:00Z")

</div>

Hi Arthur,

I'm glad that you found the solution to your problem ! For future reference, please take a look at our documentation regarding [role mapping](https://www.elastic.co/guide/en/x-pack/current/mapping-roles.html) , the behavior you witnessed is [explicitly described](https://www.elastic.co/guide/en/x-pack/current/mapping-roles.html#ldap-role-mapping).

---

<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: [January 10, 2018, 11:37am UTC](https://discuss.elastic.co/t/cant-setup-roles-with-active-directory/111543/4 "2018-01-10T11:37:09Z")

</div>

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