# Set Elastic Password during deployment

**URL:** <https://discuss.elastic.co/t/set-elastic-password-during-deployment/317457>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security, docker\
**Created:** [October 26, 2022, 3:47am UTC](https://discuss.elastic.co/t/set-elastic-password-during-deployment/317457 "2022-10-26T03:47:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dum](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@Dum](https://discuss.elastic.co/u/Dum)\
**Post date:** [October 26, 2022, 3:47am UTC](https://discuss.elastic.co/t/set-elastic-password-during-deployment/317457/1 "2022-10-26T03:47:50Z")

</div>

I am new to Elasticsearch and setting it up with an `install.sh` script. I am going through the documentation and can see that for docker installation, one can specify a password for the `elastic` user in the docker-compose file with something like:

```auto
    environment:
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD 

```

I am not deploying on docker. I am deploying on an ec2 instance using a script. How can I achieve this? I want to be able to specify a password for the elastic and kibana user.

Also, while sending logs from logstash to `elasticsearch` as output, which username and password would I have to specify in my logstash configuration?

The created logstash username and password, or the `elastic` user username and password?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 26, 2022, 3:52am UTC](https://discuss.elastic.co/t/set-elastic-password-during-deployment/317457/2 "2022-10-26T03:52:18Z")

</div>

Welcome to our community! 😃

Are you using a deb/rpm repo or package?

> [@Dum](#):
>
> The created logstash username and password, or the `elastic` user username and password?

You should create a specific one, and not use the `elastic` superuser.

---

<div class="post-metadata">

**Author:** ![Dum](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@Dum](https://discuss.elastic.co/u/Dum)\
**Post date:** [October 26, 2022, 4:31am UTC](https://discuss.elastic.co/t/set-elastic-password-during-deployment/317457/3 "2022-10-26T04:31:05Z")

</div>

I am using deb. When you say I should create a specific one; do you mean creating users?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 26, 2022, 6:13am UTC](https://discuss.elastic.co/t/set-elastic-password-during-deployment/317457/4 "2022-10-26T06:13:35Z")

</div>

You can set the password using the method described here - [Automate Elasticsearch-reset-password in bash script - #5 by Chma](https://discuss.elastic.co/t/automate-elasticsearch-reset-password-in-bash-script/317429/5)

> [@Dum](#):
>
> do you mean creating users?

Yep.

---

<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 23, 2022, 6:14am UTC](https://discuss.elastic.co/t/set-elastic-password-during-deployment/317457/5 "2022-11-23T06:14:10Z")

</div>

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