# New users do not receive mails and can not log in

**URL:** <https://discuss.elastic.co/t/new-users-do-not-receive-mails-and-can-not-log-in/252496>\
**Category:** Kibana\
**Tags:** elastic-stack-security\
**Created:** [October 19, 2020, 8:01am UTC](https://discuss.elastic.co/t/new-users-do-not-receive-mails-and-can-not-log-in/252496 "2020-10-19T08:01:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matteo\_Fiore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matteo_fiore/32/77411_2.png) [@Matteo\_Fiore](https://discuss.elastic.co/u/Matteo_Fiore)\
**Post date:** [October 19, 2020, 8:01am UTC](https://discuss.elastic.co/t/new-users-do-not-receive-mails-and-can-not-log-in/252496/1 "2020-10-19T08:01:43Z")

</div>

Hello,

I am having some problems creating new users and granting them access.

**What I am doing**  
Stack Management \> Users \> Create User

When trying to log in with the new user I receive "Invalid username or password. Please try again."

I have been researching a bit and found [this thread](https://discuss.elastic.co/t/unable-to-login-to-kibana-using-newly-created-user/195123).  
In order to check if the default realm was enabled, I ran

`GET /_security/user/{username}`

Based on [the documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html)

> If the user is not defined in the `native` realm, the request 404s.

But I do receive an answer in the form

```auto
{
  "username" : {
    "username" : "username",
    "roles" : [],
    "full_name" : "FullName",
    "email" : "xyz@aaa.lk",
    "metadata" : { },
    "enabled" : true
  }
}

```

Any suggestions on why I am not able to log in with any newly created users?

Thank you beforehand.

Best,  
Matteo Fiore

---

<div class="post-metadata">

**Author:** ![Matteo\_Fiore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matteo_fiore/32/77411_2.png) [@Matteo\_Fiore](https://discuss.elastic.co/u/Matteo_Fiore)\
**Post date:** [October 19, 2020, 12:51pm UTC](https://discuss.elastic.co/t/new-users-do-not-receive-mails-and-can-not-log-in/252496/2 "2020-10-19T12:51:19Z")

</div>

Update:

Using  
`GET /_cluster/settings?include_defaults=true`  
I have been digging around and found out that the realms settings look like

```auto
{
  "realms": {
    "saml": {
      "cloud-xyz": {
        ...
        "order": "3"
      }
    },
    "native": {
      "native": {
        "order": "1"
      }
    },
    "file": {
      "found": {
        "order": "0"
      }
    }
  }
}

```

I have been trying to use the

```auto
PUT /_cluster/settings
{
  "persistent": {
    "xpack": {
      "security": {
        "authc": {
          "realms": {
            "native": {
              "native": {
                "order": 0
              }
            }
          }
        }
      }
    }
  }
}

```

to change the order but no luck so far.

---

<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:** [October 19, 2020, 1:37pm UTC](https://discuss.elastic.co/t/new-users-do-not-receive-mails-and-can-not-log-in/252496/3 "2020-10-19T13:37:53Z")

</div>

1. You _should not_ need to change the realm settings in your cloud instance. The defaults are fine you can't and there is no need to set the native to order 0.

2. 

> New users do not receive mails

They shouldn't , this is not a functionality that elastic cloud offers at this time ( i.e. deployment users getting notified of account creation via email )

3. 

> I have been researching a bit and found [this thread](https://discuss.elastic.co/t/unable-to-login-to-kibana-using-newly-created-user/195123).

This is about and on premise installation and not applicable to your case

> [@Matteo\_Fiore](#):
>
> When trying to log in with the new user I receive "Invalid username or password. Please try again."

Can you clarify where do you try to login ? Is it the same kibana instance as the one you created the user in? What version is your kibana + es cluster ?

---

<div class="post-metadata">

**Author:** ![Matteo\_Fiore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matteo_fiore/32/77411_2.png) [@Matteo\_Fiore](https://discuss.elastic.co/u/Matteo_Fiore)\
**Post date:** [October 19, 2020, 2:02pm UTC](https://discuss.elastic.co/t/new-users-do-not-receive-mails-and-can-not-log-in/252496/4 "2020-10-19T14:02:15Z")

</div>

Hi,  
Thank you for your answer.

Ok, I realized I was making a rather silly mistake. I was trying to log in into `cloud.elastic.co` instead of logging in into Kibana.

How can I create users so that they log-in and manage the deployments?

Also, I've been trying to connect to ES through Spark using the newly created users.

```auto
(
      spark.read
      .format("org.elasticsearch.spark.sql")
      .option("es.nodes.wan.only","true")
      .option("es.net.http.auth.user", "username")
      .option("es.net.http.auth.pas", "password")
      .option("es.nodes", "node")
      .option("es.port", "port")
      .load("index/test-index")
)

```

But what I obtain is (for both `elastic` and newly created user):

```auto
org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: org.elasticsearch.hadoop.rest.EsHadoopRemoteException: security_exception: unable to authenticate user [username] for REST request [/]
null

```

At first, I thought that the issue was the same as not being able to log-in in the UI, but then trying to connect using

```auto
from datetime import datetime
from elasticsearch import Elasticsearch

es = Elasticsearch(['endpoint'], http_auth=('username', 'password'))

doc = {
    'author': 'kimchy2',
    'text': 'Elasticsearch: cool. bonsai cool.',
    'timestamp': datetime.now(),
}
res = es.index(index="test-index", id=3, body=doc)
print(res['result'])

```

does not result in error.

Would you be able to help with that issue as well?  
Thank you beforehand!

---

<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:** [November 16, 2020, 2:02pm UTC](https://discuss.elastic.co/t/new-users-do-not-receive-mails-and-can-not-log-in/252496/5 "2020-11-16T14:02:15Z")

</div>

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