September 10, 2022

How To Disable Two-factor Authentication (TFA) in Home Assistant (Hass OS)

Long story short - I got a new phone and didn't back up old Authenticator app configurations. The next time I needed to log into Home Assistant, I was out of luck without a code.

My setup is running Home Assistant via VMware ESXi. I'm able to access the core HA OS, but nothing more. Based on this forum post, I knew I could access a file called "auth_module.totp" and remove it to bypass TFA. But I didn't know how I could without SSH access to box.

Lesson Learned - while in the HassOS console you cannot run basic Unix commands.

Solution

First, from the HassOS Command Line Interface (CLI), type "login." You are taken from the basic HassOS CLI into a Unix Shell prompt.

Run "docker ps-a" to see the running Docker instances. (You want to ensure you see one named "home assistant"). Run the below command to log into the Docker instance.

docker exec -it homeassistant bash

You should be placed into a folder called /config. Change the directory to a hidden folder, ".storage." List out the files and look for "auth_module.totp". Rename the file with a ".tmp" extension.

With /config/.storage is the single file, auth_module.totp, that drives TFA for Hass OS.

Reboot the server. Next time you attempt to log in via the web interface, you will not be prompted for TFA.

FILED UNDER:  Home Automation
RELATED POST TO READ

Home Assistant - Turning On My Sonos When An Orioles Baseball Game is Starting

Learn more in-depth coding and automation with Home Assistant. Take data from the MLB API and use the game start time to turn on a Sonos at first pitch.

RELATED POST TO READ

Fixing Google Home and its Confusion with TV and Chromecast device when asking "Turn on the TV"

Lesson Learned, Google makes the "TV" a Chromecast when introduced to a room. Meaning you can't override "Turn on the TV".