Recover COUCHDB_ADMIN_PASSWORD

Hi everyone,
Is there a solution to recover `COUCHDB_ADMIN_PASSWORD ?
Thanks

@Babacar_Gueye - welcome to to forum! I see this is your first post. Thanks so much for asking your question. Every time the community engages here, the more we we’re able to solve your problem as well as help those who follow with the same problem later.

I assume you’re in a self hosted or local set up situation, and you don’t know the password to be able to log in to the CHT web GUI as an admin. Please let me know if this isn’t correct!

If you haven’t done any customizations, then the password may simply be password, which is the default in our docker-compose file.

Alternately, you can check the COUCH_URL environment variable with an echo call:

echo $COUCH_URL                                                     
http://admin:password@localhost:5984/medic

In this case, it is simply password for me in my development setup.

Finally, if you’re really stuck, there’s a more involved process to forcefully reset the password. Use this method with caution as any other services that are dependent on the old password will need to be updated as well.

Let’s update the medic user’s password to changeme.

  1. List your containers to find the right one:
    docker ps --format="{{.Names}}"|grep medic
    medic-os
    helper_test_medic-os_1
    
  2. In this case we want the default medic-os container, so let’s get shell on it:
    docker exec -it medic-os bash
    
  3. Edit the CouchDB local.ini file. I like vim:
    vim /srv/settings/medic-core/couchdb/local.ini
    
  4. Remove the pbkdf2 hash for the medic user and replace it with the plaintext password. When CouchDB reboots, it will re-hash this for you. Change this:
    medic = -pbkdf2-8333fed3be2f6d733724bd7e16b50018d31b26f5,54b5a496afb8cc950ea4d5e9d49532ae,10
    
    To this:
    medic = changeme
    
  5. Finally, restart CouchDB:
    /boot/svc-restart medic-core couchdb
    

Please let us know if I made the wrong assumption, if you’re still stuck or if this solved your problem!

Hi MrJones
Thank you for the Welcome message and your reply
These procedures are very helpul and will serve in the future. i deployed CHT in AWS and i was able to find the paswword in the medic-os container at this location /srv/storage/medic-core/passwd.
Thank you