Password lost

How to change the lost password?

I had no new onboarding flow during the first start. System asked for the user and password, which I used testing auth in pervious versions, but I lost both.

1 Like

Not sure if this works in 0.77.
Rename your config/.storage folder to .storage.bak and restart HA.
Clean the cache of your browser.

I’m have HA on MAC and can’t locate such folder.

Should be in the same folder where your configuration.yaml lives.
With the point at the beginning the folder is hidden.
Don’t know how to show hidden files/folders on mac.

Greta it’s work .
Thank you a lot

I made a few tests with hass.io 0.76.2 and 0.77.0b4

You have to:

  • Stop HA (Services -> homeassistant.stop)
  • Rename or delete the .storage folder
  • Clean your browser cache and close it, also delete some cookies you have from HA.
  • Start HA, you’ll get the Login to create an user account
  • Login with that user

I had to restart the browser and login three times to get the “Save login” popup. (Firefox)

Maybe helps others.

2 Likes

It works, thanks a lot.

A better way to do this is to

  • remove .storage/auth*
  • remove .storage/onboarding

There is no need to delete the entity registry and other configurations.

5 Likes

See also the documentation.

1 Like

Where is this .storage located? I could not find in in Windows explorer.

config/.storage is a hidden folder. You will have to enable “Show hidden folders” in folder options.

I just came across this problem with my setup, forgot my password.
There are a couple of ways to reset your password without needing to recreate your user.
First way:

  1. Log in using the legacy password. (set in configuration.yaml)
  2. Create a new temporary user.
  3. Shutdown HA and edit auth_provider.homeassistant in /usr/share/hassio/homeassistant/.storage (on debian hassio), copying the test user’s password to your own.
  4. Startup HA and log in.
  5. Delete the temp user.

Second way (suggested by u/sweharris on Reddit)

  1. Log into HA system using ssh
  2. Enter HA environment. (I do this with ‘docker exec -it homeassistant /bin/bash’)
  3. Start python.
  4. Enter the following.
    import bcrypt
    import base64
    password=“hello”
    hashed = bcrypt.hashpw(password.encode(), bcrypt.gensalt(rounds=12))
    hashed = base64.b64encode(hashed)
    print(hashed)
  5. Shut down HA
  6. Replace your password in auth_provider.homeassistant with the password you got from python. (you want the part between the single quotes)
  7. Start HA and log in.

I used the first method to get my ID back and I tried the second on a test ID to see if it would work. (it does!)

Hope this helps anyone else having a lost password issue.

6 Likes

[skywise], this is genius! thank

Third way:

1. login to the homeassistant docker or console
2. hass --script auth -c /config change_password <user> <password>
3. Restart HA

You can use “hass --script auth -c /config list” command to list the users

12 Likes

Thank you. It’s a tragedy this is not in the documentation (as usual).

It IS in the documentation, as I linked to. Also, if you don’t like the docs, feel free to add/edit/fix. It’s all open source.

2 Likes

Saved my life. Thank you

It worked and all my previous configurations remained the same. Thanks!