Hass.io + docker + ssh key

Ok, so I’m having a hard time trying to get ssh commands to work. I know that I need to set up a public key and add that the machine I’m trying to access, but I can’ for the life of me get it to work. I’ve got this working in the past from my pi running HA in a virtual environment to my debian server with no problems, but now I have hass.io running in a docker on my server just can’t get the keys to work. I’ve followed so many different tutorials, and nothing is working.

Can anyone running hass.io in docker please tell me how to get this working?

Not sure if it helps or not, but I’m running the SSH & Terminal addon from the Community Hass.io Addons from the addon store.

I’m still struggling with this.

Every time I run a command it fails. Guessing cause it is still asking for the password.

Can you post the SSH Terminal Config info? If you are on an Ubuntu machine, did you change the port 22 to something different like port 222?

I have docker running on Debian. Current port is 22222.

I can connect fine using putty on my PC, I just can’t get any command line sensors to run. I’m using command line sensors to run commands on other PC’s on my network to get info.

This is my ssh addon config (username and password removed):

{
  "ssh": {
    "username": "username",
    "password": "password",
    "authorized_keys": [],
    "sftp": false,
    "compatibility_mode": false,
    "allow_agent_forwarding": false,
    "allow_remote_port_forwarding": false,
    "allow_tcp_forwarding": false
  },
  "web": {
    "ssl": true,
    "certfile": "fullchain.pem",
    "keyfile": "privkey.pem"
  },
  "share_sessions": true,
  "packages": [],
  "init_commands": []
}

So, when running the addon the first time, it creates the keys and saves them to a bunch of files. I have those and have added them to the remote PC, but running any command line sensor from HA still fails as it keeps asking for the password.

This is one of my command line sensors for example"

  - platform: command_line
    command: ssh [email protected] df -t fuse.mergerfs -h | awk 'END {print $5}' | sed 's/%//'
    name: Server Drivepool Usage
    unit_of_measurement: '%'
    scan_interval: 3600

watching the log viewer in Portainer.io, I use homeassistant.update_entity to manually update the sensor, and the output error is “Host key verification failed”.

I’m not sure if I’ve missed a step somewhere, or what, but it just doesn’t seem to want to work.