Howdy. I have a bash called backup.sh script in /config and I’ve added the shell_command to configuration.yaml:

shell_command:
  backup: /root/config/backup.sh

I’m running HAOS, the shell script has the correct owner:group and permissions. I can execute the script when I ssh into HAOS, but when I call the Shell Command: backup service from HA’s Developer Tools, I get:

stderr: "/bin/sh: /root/config/gitupdate.sh: not found"
returncode: 127

Any thoughts on this?

  • ShunkW@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    I’d guess that it’s running under a different user. You can find the user executing it and provide the key to that user via copying it to their ssh directory, or by using an identity file option for your command.

    Although now that I think of it, I’d create a separate key and provide that public key to keep it separate from your user account.

    • Mike Wooskey@lemmy.d.thewooskeys.comOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      create a separate key and provide that public key to keep it separate from your user account.

      I agree this is a better method.

      I’m having trouble figuring out which user or container HA is using to execute the shell command. I docker exec -it homeassistant /bin/bash, ran ssh-keygen, and copied the pubkey into gitea, but it had no effect. I tried to run ssh-keygen in the hassio-cli container but ssh-keygen isn’t installed (so my assumption is that this isn’t a container that would do something that might need a key, because HA didn’t pre-load ssh-keygen - maybe I’m wrong). When I docker inspect the HA containers and grep for “User” or “UID”, there is no result.