Which is the password for the sudo user in Home Assistant Core?

Which is the password for the sudo user in Home Assistant Core?

Whatever you set.

You created the user after all.

(you probably don’t want to do that though, just use your normal account for sudo)

I’ve just followed the installation instructions for HA on Raspberry Pi:

sudo useradd -rm homeassistant -G dialout,gpio,i2c
sudo mkdir /srv/homeassistant
sudo chown homeassistant:homeassistant /srv/homeassistant
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate

I have not knowingly set a specific password for the user homeassistant…

My standard password of the “parent installation”/host system does not work.

Then you didn’t set one yet.

Either set one, or use another account for sudo (which is what I’d recommend).

How can I set a password for sudo in this virtual environment?

I take it you don’t normally use Linux?

The passwd command will do it, but maybe this isn’t the install method you should be running.

I’d suggest you switch to Container (Docker) or use HAOS.

Sudo hast nothing to do with the python venv.
check your /etc/sudoers and /etc/sudoers.d.
on a standard Raspberry OS ( Debian based) you likely have a file in /etc/sudoers.d allowing your standard user ( was “pi”, but I believe there was a change where you have to name the username on installation) running sudo without password.
use this user to run commands with sudo, don’t allow sudo to the “homeassistant” user

And as Tinkerer wrote, when using Core with a Python Venv as installation method you better have strong Linux skills


For the Debian Bookworm installation on the Raspberry Pi, I set the user and the password during installation. I also know how to use the passwd command, and as I have set a password for the root-/super-user I have and know the password to change the password for every new user.

However, in this virtual environemnt that is created and used to run hass, I never come across setting a password for the user homeassistant. Once I am in the virtual environment, and once I try to execute a command with sudo, I am asked for the sudo password. The password from the host installation does not work, and along the installation procedure - that I have posted above - there is no step that requires password setting, that’s why I’m asking.

I’m following the guide here. Is there any other installation method than running Core with a Python Venv?


Thanks to the hint “The passwd command will do it” in combination with “Sudo hast nothing to do with the python venv.” I was able to figure out how it’s done.

On the host system, i.e. the system that you install the HA Core system on,execute the following commands:

sudo usermod -aG sudo homeassistant

to assign the user homeassistant to the sudoer group. Then assign a password for the user homeassistant with

passwd homeassistant

This password will also work within the virtual environment. As the execution of sudo will still ask for a password in the virtual environment you need to hand over the password in the same line as the command, e.g. with:

$echo <password> | sudo -S <command>

This way it works to execute commands with sudo in the virtual environement with user homeassistant:
2023-11-27 19_56_13-R3-LAN (R3-LAN-32GB) - VNC Viewer

BTW, I’m using this to create a sensor for monitoring the size of my influxdb: