# Export/Import users/roles from Native User Authentication?

**URL:** <https://discuss.elastic.co/t/export-import-users-roles-from-native-user-authentication/91218>\
**Category:** Elasticsearch\
**Created:** [June 29, 2017, 5:02am UTC](https://discuss.elastic.co/t/export-import-users-roles-from-native-user-authentication/91218 "2017-06-29T05:02:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ngbaoan](https://avatars.discourse-cdn.com/v4/letter/n/dbc845/32.png) [@ngbaoan](https://discuss.elastic.co/u/ngbaoan)\
**Post date:** [June 29, 2017, 5:02am UTC](https://discuss.elastic.co/t/export-import-users-roles-from-native-user-authentication/91218/1 "2017-06-29T05:02:37Z")

</div>

hello

1. i use Xpack with native user authentication (users + roles) [https://www.elastic.co/guide/en/x-pack/current/native-realm.html](https://www.elastic.co/guide/en/x-pack/current/native-realm.html) , i wonder if there is anyway to export then import these users/roles, no matter if the password can be encrypted or not ?

2. Using native user authentication and cURL , how can i turn a user from "enabled:false" to "enabled:true" ? which syntax ?

thanks for reply

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [June 29, 2017, 7:40am UTC](https://discuss.elastic.co/t/export-import-users-roles-from-native-user-authentication/91218/2 "2017-06-29T07:40:04Z")

</div>

> [@](#):
>
> 1. i use Xpack with native user authentication (users + roles) [Native User Authentication | X-Pack for the Elastic Stack [6.2] | Elastic](https://www.elastic.co/guide/en/x-pack/current/native-realm.html) , i wonder if there is anyway to export then import these users/roles, no matter if the password can be encrypted or not ?

There's nothing built in, but you can do it quite easily yourself.  
The `GET` API returns something that is almost exactly the same as what you need to `PUT` to recreate the user/role.

In the case of roles, I believe you can feed the `GET` back into a `PUT` without modifying it (but I'm working from memory).

For users you would need to remove the `transient_metadata` and add a password.

[https://www.elastic.co/guide/en/x-pack/current/security-api-users.html](https://www.elastic.co/guide/en/x-pack/current/security-api-users.html)  
[https://www.elastic.co/guide/en/x-pack/current/security-api-roles.html](https://www.elastic.co/guide/en/x-pack/current/security-api-roles.html)

> [@](#):
>
> 1. Using native user authentication and cURL , how can i turn a user from "enabled:false" to "enabled:true" ? which syntax ?

See: [https://www.elastic.co/guide/en/x-pack/current/security-api-users.html](https://www.elastic.co/guide/en/x-pack/current/security-api-users.html)

```auto
curl -XPUT 'http://localhost:9200/_xpack/security/user/xxxxx/_enable?pretty'

```

---

<div class="post-metadata">

**Author:** ![ngbaoan](https://avatars.discourse-cdn.com/v4/letter/n/dbc845/32.png) [@ngbaoan](https://discuss.elastic.co/u/ngbaoan)\
**Post date:** [June 29, 2017, 7:44am UTC](https://discuss.elastic.co/t/export-import-users-roles-from-native-user-authentication/91218/3 "2017-06-29T07:44:12Z")

</div>

thank you 😃

---

<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 27, 2017, 7:44am UTC](https://discuss.elastic.co/t/export-import-users-roles-from-native-user-authentication/91218/4 "2017-07-27T07:44:28Z")

</div>

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