READING TIME: 3 MINUTES
In this guide, I’ll show you how to access Home Assistant via SSH. While I’ve personally never had the need for this, there are some instances where remote SSH access may be needed. So, this tutorial I will walk you through the process.
Let’s get started!
Step 1: Enable SSH Access
Click your profile in Home Assistant.
Toggle Advanced Mode on if it isn’t already.
Step 2: Install SSH Addon
Next, go back to Home Assistant > Supervisor > Dashboard. If Terminal & SSH isn’t already installed, click the Add-on Store tab to install it.
Click the Configuration tab at the top.
Enter a password into the Password field and save.
Under Network, set the port to 22, and then click Save.
It will prompt you to restart your addon afterwards.
Once installed and a password has been set, click the Info tab to start the addon.
Step 3: Connect to Home Assistant via Putty
Launch the SSH tool of your choice (I’m using Putty). For the Host Name, type the hostname or IP of Home Assistant and enter 22 for the port.
The first time you connect to it, a box will popup asking if you trust the host. Click Yes.
Login credentials: Root / the password you created in Terminal & SSH addon.
Now, you should be connected to HA via SSH!
Step 4: Navigate & Edit Configuration Files
To start editing some of your files, such as
configuration.yaml, use the following commands:
This will change to the root directory. This would be the same as if you clicked File Editor from within Home Assistant. Then, edit your configuration.yaml file by typing:
That’s all there is to it to access Home Assistant from an SSH client! If you don’t use Putty, or want a cleaner way to SSH into Home Assistant, there are some VSCode extensions for SSH (Remote-SSH being my favorite).
I don’t necessarily recommend editing your config files from SSH as there are much better ways of doing it. After all, for security purposes, SSH is disabled by default in Home Assistant. SSH access should be reserved for emergency situations, such as to reboot HA remotely or edit a config file if you’ve made a syntax error and need to edit something to get Home Assistant to launch.
A much better method of editing config files is by creating a Samba file share and accessing Home Assistant through Visual Studio Code editor, or by installing the Visual Studio Code add-in within Home Assistant so you can get the full power of VSCode in a browser.
If you are just testing it out, or don’t plan to use SSH access, I highly recommend disabling it completely afterwards just so you don’t forget that it’s still active.
My Favorite Home Assistant Devices
Below are some of the Home Assistant-compatible devices I personally use in my home. I highly recommend each of them.
- Zwave/Zigbee hub: Nortek GoControl HUSBZB-1
- Smart Plugs: Sonoff S31 Lite Zigbee
- Motion Sensors: Hue Indoor Motion
- Outdoor Camera: Amcrest IP5M Turret
- Robot Vacuum: Roborock S7
The full list of all Home Assistant compatible & recommended devices I use can be found on my Equipment List page.
Hi Danny. I am new to HA and just setup SSH access per your guide. However, I need to install HACS and it says to change to the user that runs HA, which is my personal user (created on install). But I cannot get SU or SUDO to work at all, it says “unknown user”, even though it is the same name as I use inside HA. Have you had to change user context in SSH and know any tricks to make it work. I doubt installing HACS under “root” will work.
“Supervisior” is now “Configurations / Add-ons, Backups & Supervisor”. Diagnosing a “502 Bad Gateway” error… any suggestions appreciated!
Hope help anyone else:
I can make it work go for user: root and passwork (Enter a password into the Password field)
Thanks for this blog, it was very helpful…
Hey Danny, you know if there is a possibility of installing containers inside home assistant OS for x86. There are many integration which needs to be installed as containers. Can you please suggest?
I don’t see anywhere in your instructions where to generate or save ssh keys?
You don’t need to generate a key. You just enable SSH access and then log into Home Assistant using an SSH tool like Putty. Credentials are Root and whatever password you set
Thanks for this clear and easy help
I do not find the path to the setting:
Home Assistant 2022.11.3
Operating System 9.3
Frontend 20221108.0 – latest