Export/Import users/roles from Native User Authentication?


  1. i use Xpack with native user authentication (users + roles) 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

1 Like

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.


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

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

thank you :smiley:

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