{"id":298,"date":"2021-03-26T15:16:12","date_gmt":"2021-03-26T15:16:12","guid":{"rendered":"https:\/\/andrejacobs.org\/?p=298"},"modified":"2022-04-11T20:24:23","modified_gmt":"2022-04-11T20:24:23","slug":"home-automation-enable-ssh-on-home-assistant","status":"publish","type":"post","link":"https:\/\/andrejacobs.org\/home-automation\/home-automation-enable-ssh-on-home-assistant\/","title":{"rendered":"Home Automation – Enable SSH on Home Assistant"},"content":{"rendered":"\n
As part of Day 18<\/a> of my 100 Days of Learning<\/a> I wanted to upgrade my Home Assistant<\/a> setup to run from an external SSD. There is a well known issue that SD cards on Raspberry Pis corrupt after a while and also I didn’t want Home Assistant to fill up the SD card too quickly.<\/p>\n I am running Home Assistant on a Raspberry Pi 3B and I would like to be able to SSH into it. By default the Home Assistant OS does not have SSH enabled and you need to install an add-on to be able to do this.<\/p>\n You need to install an add-on to get SSH working. But first you need to enable Advanced mode<\/a> so that extra add-ons can be searched for on the dashboard.<\/p>\n To install the add-on go to the Supervisor Add-on Store<\/a> and search for ssh.<\/p>\n <\/p>\n I am installing the Official "Terminal & SSH" add-on because the community one’s security rating is pretty low.<\/p>\n Enabled the Watchdog and Show in sidebar.<\/p>\n <\/p>\n Interestingly this comes with a web terminal.<\/p>\n <\/p>\n Remote SSH access from the network is disabled by default.<\/strong> +10 in my book.<\/p>\n I will generate a new SSH key pair to be used only with Home Assistant and this Raspberry Pi.<\/p>\n Added the newly created id_rsa_homeassistant and .pub file to my password manager.<\/p>\nSSH into the Raspberry Pi 3B<\/h3>\n
$ ssh homeassistant.local\nssh: connect to host homeassistant.local port 22: Connection refused\n<\/code><\/pre>\n
$ ssh-keygen -t rsa -b 4096 -f ~\/.ssh\/id_rsa_homeassistant -C "Home Assistant RPi"\n\nGenerating public\/private rsa key pair.\nEnter passphrase (empty for no passphrase):\nEnter same passphrase again:\nYour identification has been saved in .ssh\/id_rsa_homeassistant.\nYour public key has been saved in .ssh\/id_rsa_homeassistant.pub.\nThe key fingerprint is:\nSHA256:i0MllcT0ioS\/6ab9vD\/gsVNOmnMBCYrP17w4gBS4QuY Home Assistant RPi\nThe key's randomart image is:\n+---[RSA 4096]----+\n| . ++. |\n|.o. ...o. |\n|+. o..o.... |\n|oEo .o +o. |\n|.. + +oS. |\n| . +..+=.+ |\n| o=o.@ . |\n| o+oO + |\n| .ooo+*.. |\n+----[SHA256]-----+\n\n# Added this to my Mac's keychain\n$ ssh-add -K ~\/.ssh\/id_rsa_homeassistant\n<\/code><\/pre>\n