# How to change password of Bahmni/OpenMRS (and securing the server)

**URL:** https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707
**Category:** Bahmni
**Tags:** security, install
**Created:** [May 26, 2022, 10:04am UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707 "2022-05-26T10:04:10Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![gsluthra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gsluthra/32/1453_2.png) [@gsluthra](https://talk.openmrs.org/u/gsluthra)
#### Post date: [May 26, 2022, 10:04am UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/1 "2022-05-26T10:04:10Z")

</div>

A lot of users seem to install Bahmni/OpenMRS and don’t change the DEFAULT admin credentials. This is a **serious security risk**.

If you are an ADMIN of any Bahmni server, that is being used in Production / QA / Public exposed – please change the admin/superman credentials, to reduce your security risk. Also don’t use default DB credentials.

Please read

1. Change password of Bahmni user: [https://bahmni.atlassian.net/wiki/spaces/BAH/pages/114361274/Logging+into+Bahmni](https://bahmni.atlassian.net/wiki/spaces/BAH/pages/114361274/Logging+into+Bahmni)

2. OpenELIS: [https://bahmni.atlassian.net/wiki/spaces/BAH/pages/48889888/Lab+Security+and+Access+Control+OpenELIS](https://bahmni.atlassian.net/wiki/spaces/BAH/pages/48889888/Lab+Security+and+Access+Control+OpenELIS)

3. In Bahmni Configuration Files: [https://bahmni.atlassian.net/wiki/spaces/BAH/pages/53837974/List+Of+Configurable+Installation+Variables](https://bahmni.atlassian.net/wiki/spaces/BAH/pages/53837974/List+Of+Configurable+Installation+Variables)

4. Securing Bahmni Server: [https://bahmni.atlassian.net/wiki/spaces/BAH/pages/2342780946/Securing+and+Protecting+the+Bahmni+Server](https://bahmni.atlassian.net/wiki/spaces/BAH/pages/2342780946/Securing+and+Protecting+the+Bahmni+Server)

If you still need help, please post a question on our SLACK channel or on this talk forum. Thanks!

---

<div class="post-metadata">

### Author: ![gsluthra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gsluthra/32/1453_2.png) [@gsluthra](https://talk.openmrs.org/u/gsluthra)
#### Post date: [September 9, 2022, 6:20am UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/2 "2022-09-09T06:20:30Z")

</div>

Bumping this up. We came across another _PUBLIC_ instance of Bahmni today, where the default admin credentials were setup. This is very bad!

Please request everyone to ensure that for Bahmni deployments in production/real world to CHANGE ALL DEFAULT CREDENTIALS. Not doing so can put the implementor / hospital in Legal trouble and serious headaches.

This is true for any OpenMRS/Bahmni deployment. Be responsible. Refer to the links attached in this thread on how to make changes.

---

<div class="post-metadata">

### Author: ![ramashish](https://talk.openmrs.org/letter_avatar/ramashish/32/5_5575768a8748004e209b776fc1b2916d.png) [@ramashish](https://talk.openmrs.org/u/ramashish)
#### Post date: [September 11, 2022, 2:30am UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/3 "2022-09-11T02:30:16Z")

</div>

If the Bahmni admin password is changed after the installation then ensure to change the atom feed connect passwords too

for OpenMRS to ODOO sync, change passwords in /opt/bahmni-erp-connect/bahmni-erp-connect/WEB-INF/classes/erp-atomfeed.properties

for openmrs to lab sync, change passwords in /opt/bahmni-lab/bahmni-lab/WEB-INF/classes/atomfeed.properties

---

<div class="post-metadata">

### Author: ![gsluthra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gsluthra/32/1453_2.png) [@gsluthra](https://talk.openmrs.org/u/gsluthra)
#### Post date: [April 6, 2023, 12:58pm UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/4 "2023-04-06T12:58:17Z")

</div>

Please see this documentation page too (comprehensive for Bahmni Docker). Thanks to @gokul for the detailed writeup: [https://bahmni.atlassian.net/wiki/spaces/BAH/pages/3135995905/Changing+Default+Credentials+of+Bahmni+Docker](https://bahmni.atlassian.net/wiki/spaces/BAH/pages/3135995905/Changing+Default+Credentials+of+Bahmni+Docker)

---

<div class="post-metadata">

### Author: ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)
#### Post date: [April 19, 2023, 9:50am UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/5 "2023-04-19T09:50:58Z")

</div>

I don’t know if this happens to me only but once I reset the atomfeed password and update the .env file, I see an error message in the openmrs log that says `authentication with openelis failed`. As soon as I change it back to the default password, the error is cleared. What could be causing this?

I tried changing the password from UI and from the database but the same issue occurs. I’m wondering if there is some place again where the password persists after resetting it.

---

<div class="post-metadata">

### Author: ![gsluthra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gsluthra/32/1453_2.png) [@gsluthra](https://talk.openmrs.org/u/gsluthra)
#### Post date: [April 19, 2023, 10:19am UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/6 "2023-04-19T10:19:11Z")

</div>

Can you provide some more information. Did you change the openelis creds from UI/DB, and then updated OpenMRS configuration for ELIS passwords (atomfeed files, .env, etc) and still OpenMRS gave an error?

If you can provide the high level sequence of steps you took and which system gave an error, it might help resolve the issue.

I assume since you mentioned .env file, you are using Docker version of Bahmni.

Thanks!

---

<div class="post-metadata">

### Author: ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)
#### Post date: [April 19, 2023, 8:28pm UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/7 "2023-04-19T20:28:46Z")

</div>

Yes its a docker installation.

First sequence

I changed the password from UI then updated the .env file, got the error

Second sequence

I changed the password from DB, then updated the .env file and still got the error.

I see the error message in openmrs log file

---

<div class="post-metadata">

### Author: ![gokul](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gokul/32/17065_2.png) [@gokul](https://talk.openmrs.org/u/gokul)
#### Post date: [April 20, 2023, 11:03am UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/8 "2023-04-20T11:03:08Z")

</div>

> [@tapologo](#):
>
> word from UI and from the database but the same issue occurs. I’m wondering if there is some place again where the password persis

Can you try the below sequence?

- Bring all the services down.
- Update the password in .env file `OPENELIS_ATOMFEED_USER` and `OPENELIS_ATOMFEED_PASSWORD`
- Bring the Bahmni services up.
- update the new password in UI.

---

<div class="post-metadata">

### Author: ![tapologo](https://talk.openmrs.org/letter_avatar/tapologo/32/5_5575768a8748004e209b776fc1b2916d.png) [@tapologo](https://talk.openmrs.org/u/tapologo)
#### Post date: [April 24, 2023, 12:25pm UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/9 "2023-04-24T12:25:14Z")

</div>

I have followed the sequence but as soon as I updated it, the error re-surfaced

```auto
bahmni-standard-openmrs-1 | Caused by: org.bahmni.webclients.WebClientsException: Authentication with OpenELIS failed
bahmni-standard-openmrs-1 | at org.bahmni.webclients.OpenElisAuthenticator.refreshRequestDetails(OpenElisAuthenticator.java:68) ~[web-clients-0.94.3.jar:?]
bahmni-standard-openmrs-1 | at org.bahmni.webclients.OpenElisAuthenticator.getRequestDetails(OpenElisAuthenticator.java:38) ~[web-clients-0.94.3.jar:?]
bahmni-standard-openmrs-1 | at org.bahmni.webclients.HttpClient.getCookies(HttpClient.java:39) ~[web-clients-0.94.3.jar:?]
bahmni-standard-openmrs-1 | at org.bahmni.module.elisatomfeedclient.api.client.OpenElisFeedClient.createAtomFeedClient(OpenElisFeedClient.java:59) ~[elisatomfeedclient.jar:?]
bahmni-standard-openmrs-1 | at org.bahmni.module.elisatomfeedclient.api.client.OpenElisFeedClient.getAtomFeedClient(OpenElisFeedClient.java:50) ~[elisatomfeedclient.jar:?]
bahmni-standard-openmrs-1 | at org.bahmni.module.elisatomfeedclient.api.client.impl.OpenElisPatientFailedEventsFeedClientImpl.processFailedEvents(OpenElisPatientFailedEventsFeedClientImpl.java:70) ~[elisatomfeedclient.jar:?]

```

---

<div class="post-metadata">

### Author: ![gokul](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gokul/32/17065_2.png) [@gokul](https://talk.openmrs.org/u/gokul)
#### Post date: [April 25, 2023, 1:11pm UTC](https://talk.openmrs.org/t/how-to-change-password-of-bahmni-openmrs-and-securing-the-server/36707/10 "2023-04-25T13:11:37Z")

</div>

I have retested the behaviour and password change is working as expected.

Steps followed-

1. Update the password in UI → Error didn’t occur and sync is working fine.

2. Restarted the OpenMRS container using command `docker compose restart openmrs` → Error came as expected(Authentication with OpenELIS failed)

3. Update the credentials for OpenELIS atomfeed in .env file `OPENELIS_ATOMFEED_USER` and `OPENELIS_ATOMFEED_PASSWORD` (Same as updated in UI)

4. Recreate OpenMRS service using the command `docker compose up -d` → No errors and sync is working fine with the new credentials.

With this we can understand that the password is not cached anywhere and working as expected. If issue still persist please reach out to us through Slack, we can connect.

CC: @mohant @gsluthra
