Security Exception while trying to open all indices

Hi,

While trying snapshot and restore, unfortunately I closed all the indices after taking snapshot. Now I am trying to open all the indices but getting a security exception.

$ curl --cacert 'certificate_path' -u "elastic:xxxxxxxxx" -XPOST "https://node_name:9200/*/_open?pretty"
{
"error" : {
"root_cause" : [
{
"type" : "security_exception",
"reason" : "failed to authenticate user [elastic]",
"header" : {
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""
}
}
],
"type" : "security_exception",
"reason" : "failed to authenticate user [elastic]",
"header" : {
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""
}
},
"status" : 401
}

How do i open all the indices now?

Did you close the .security index?
Don't do that.

You'll need to create an alternative superuser in the file realm.

Assuming you haven't modified the default realm setup, then you just need to run this on one of your nodes.

bin/x-pack/users useradd admin -r superuser -p changeme
sleep 5
curl --cacert 'certificate_path' -u "admin:changeme"  -XPOST "https://localhost:9200/.security*/_open"

That should open the security index again, and you can then work with the elastic user as normal.
At the end, remove the admin user with:

bin/x-pack/users userdel admin

Thanks Tim, Working fine...

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