How To Connect to Home Assistant via SSH

by Danny
0 comment


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:

cd /config

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:

nano configuration.yaml

Wrapping Up

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.

The full list of all Home Assistant compatible & recommended devices I use can be found on my Equipment List page.

0 comment

You may also like

Leave a Comment