# Read- only access to index

**URL:** https://discuss.elastic.co/t/read-only-access-to-index/45405
**Category:** Kibana
**Created:** [March 24, 2016, 10:30pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405 "2016-03-24T22:30:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dkota](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dkota](https://discuss.elastic.co/u/dkota)
#### Post date: [March 24, 2016, 10:30pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405/1 "2016-03-24T22:30:11Z")

</div>

I want give read-only access to an index for a local user, in kibana.

Here is role assigned:

bash-4.1$ esusers list  
esuser : read\_all\_indices

roles.yml:

# Read-only operations on indices

read\_all\_indices:  
indices:  
'\*':  
privileges: read  
'.kibana':  
privileges: indices:admin/exists, indices:admin/mapping/put, indices:admin/mappings/fields/get, indices:admin/refresh, indices:admin/validate/query, indices:data/read/get, indices:data/read/mget, indices:data/read/search, indices:data/write/delete, indices:data/write/index, indices:data/write/update

I'm getting the below error:

Courier Fetch Error: unhandled courier request error: [security\_exception] action [indices:data/read/mget] is unauthorized for user [esuser]

shouldn't privilege: read be inclusive of data/read/mget? I have tried including that privilege as well.  
I still get the same error .

What am I missing here?

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [March 24, 2016, 11:41pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405/2 "2016-03-24T23:41:57Z")

</div>

Some things around privileges have been changing. What version of Elasticsearch and Kibana are you using?

---

<div class="post-metadata">

### Author: ![dkota](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dkota](https://discuss.elastic.co/u/dkota)
#### Post date: [March 25, 2016, 2:32pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405/3 "2016-03-25T14:32:06Z")

</div>

Shield 2.2.0  
Elasticsearch 2.2.0  
Kibana 4.4.1

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [March 25, 2016, 3:22pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405/4 "2016-03-25T15:22:44Z")

</div>

Kibana never writes to the data indexes (like logstash-\* for example). So I think what you want is for a readonly user (with a readonly role) to Not be allowed to create/update/delete index patterns, saved searches, visualizations, or dashboards. Those things are all in the .kibana index, so below I've ONLY changed the privileges for the .kibana index.

That way they can Read everything and run queries, even create new visualizations and dashboards (on any existing index pattern) but not save any changes.

If that's correct, in this example below I

```
readonly:
      cluster: 
          - cluster:monitor/nodes/info
          - cluster:monitor/health 
      indices:
        '*':
          privileges: indices:admin/mappings/fields/get, indices:admin/validate/query, indices:data/read/search, indices:data/read/msearch, indices:data/read/field_stats, indices:admin/get
        '.kibana':
          privileges: indices:admin/exists, indices:admin/mappings/fields/get, indices:admin/refresh, indices:admin/validate/query, indices:data/read/get, indices:data/read/mget, indices:data/read/search

```

I removed these privs;

- indices:admin/mapping/put,
- indices:data/write/delete
- indices:data/write/index
- indices:data/write/update

Or did you only want the user to not be able to change the index pattern but still be able to create/modify/save Saved searches, Visualizations, and Dashboards?

Regards,  
Lee

---

<div class="post-metadata">

### Author: ![dkota](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dkota](https://discuss.elastic.co/u/dkota)
#### Post date: [March 25, 2016, 4:40pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405/5 "2016-03-25T16:40:44Z")

</div>

Lee,

I used the privs in the example. I still get this error.

Courier Fetch Error: unhandled courier request error: [security\_exception] action [indices:data/read/mget] is unauthorized for user [esuser]

---

<div class="post-metadata">

### Author: ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)
#### Post date: [March 25, 2016, 5:51pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405/6 "2016-03-25T17:51:26Z")

</div>

Are you using both the Elasticsearch Shield x-plugin and the Kibana Shield plugin which gives you the login screen on Kibana? ![](https://us1.discourse-cdn.com/elastic/original/2X/9/936a1fe4eda588aadc371794cb491aaec47e5e1e.png)

Or are you only using the Elasticsearch Shield plugin which gives you the browser pop-up login dialog?

If you're only using the Elasticsearch Shield plugin, and you make any typos on the user or password, I believe you get that mget security exception (I know because I accidentally called my user readyonly instead of readonly).

If you know you have the correct user and password and are still getting the mget security exception I would revert back to the original user permissions and make sure it works, and then remove those 4 privileges I noted above, one at a time, log out and back in. If you're watching the Elasticsearch log when you save the roles.yml file you should see a message indicating the roles were updated;

`updated roles (roles file [D:\k4.4-es2.2-final\elasticsearch-2.2.0\config\shield\roles.yml] changed)`

---

<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, 1:57pm UTC](https://discuss.elastic.co/t/read-only-access-to-index/45405/7 "2017-07-06T13:57:43Z")

</div>


