Home Assistant Community Add-on: SSH & Web Terminal

This got me as well… There are 2 separate sections for password - the ssh section, which is the one you’re talking about where you put your key, and the web section.

I have set up SSH & Web Terminal successfully and can get to my pi via the web interface. I would like to ust ftp or sftp to move some files from my pi to pc and then back. I set up filezilla and can get to the pi and move around the directories with out issue. When I try to move a file from the pi to my pc I get

Status:Connecting to 192.168.1.104…
Response:fzSftp started, protocol_version=8
Command:|open “[email protected]” 22
Error: Network error: Connection refused
Error Could not connect to server

Here is my configuration.

{
“log_level”: “debug”,
“ssh”: {
“enable”: true,
“port”: 22,
“username”: “root”,
“password”: “xxxxxxxxxxx”,
“authorized_keys”: ,
“sftp”: true,
“compatibility_mode”: false,
“allow_agent_forwarding”: false,
“allow_remote_port_forwarding”: false,
“allow_tcp_forwarding”: false
},
“web”: {
“enable”: true,
“port”: 7681,
“username”: “xxxxxx”,
“password”: “xxxxxxxx”,
“ssl”: true,
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”
},
“share_sessions”: true,
“packages”: ,
“init_commands”:
}

Can someone suggest something.

Thanks

Try compatibility mode true. I had to do that to get iTerminalPro to work on my iPad. I also have ssl disabled - may not be your problem. Here is my config:

{
  "log_level": "info",
  "ssh": {
    "enable": true,
    "port": 22,
    "username": "root",
    "password": "",
    "authorized_keys": [
      "ssh-rsa key-here    ],
    "sftp": true,
    "compatibility_mode": true,
    "allow_agent_forwarding": false,
    "allow_remote_port_forwarding": false,
    "allow_tcp_forwarding": false
  },
  "web": {
    "enable": true,
    "port": 7681,
    "username": "!secret ssh_user",
    "password": "!secret ssh_pass",
    "ssl": false,
    "certfile": "fullchain.pem",
    "keyfile": "privkey.pem"
  },
  "share_sessions": true,
  "packages": [],
  "init_commands": []
}

Without a detailed error message displayed in the log, I am unable to determine the source of the failure in the 10-requirements.sh script. :frowning:

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
[cont-init.d] 02-updates.sh: exited 0.
**[cont-init.d] 10-requirements.sh: executing... **
**[cont-init.d] 10-requirements.sh: exited 1.**
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.
 
 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.

I changed the log level to ‘debug’ and finally got more information.
Then it became a matter of finding where to place the certificate and privatekey files.
They go in /ssh directory. Hope this helps someone else.

Seems the addon’s folder is empty, is there a rick to get the mount to work?

I’m having issues starting the component on lastest Hassio (0.81.0dev):

18-10-30 21:52:03 ERROR (SyncWorker_16) [hassio.docker] Can’t start addon_a0d7b954_ssh: 500 Server Error: Internal Server Error (“linux runtime spec devices: error gathering device information while adding custom device “/dev/ttyACM0”: no such file or directory”)

This seems to have only started since the latest update for Hassio was applied… anyone else receiving similar?

Managed to fix this just now by reinstalling the addon through another browser, seems something had flaked out.

Will it be possible to get commands like apt or yum working?

No, this add-on is based on Alpine Linux, which uses apk instead of apt/yum.

https://pkgs.alpinelinux.org/packages
https://github.com/hassio-addons/addon-ssh#option-packages

:tada: Release v3.5.1

This release has some small upgrades and re-activates the use of the docker command :tada:.

Full Changelog

  • Spelling correction. (#41) (@dayofdoom)
  • Upgrades git to 2.18.1-r0
  • Upgrades libxml2-utils to 2.9.8-r1
  • Updates Docker usage instructions when protection mode is disabled
  • Corrects typo in Docker warnings (#44) (@ludeeus)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck or https://buymeacoff.ee/frenck

I guess that even if we now have docker access when we ssh into hass.io (With protection mode disabled).
That does NOT mean that hass.io can run docker commands from “command_line switch” or “shell command”
Or can i have hass.io ssh:ing into itself throu this addon and have disabled protection mode?
I really want to have a lovelace button that run a docker command.

docker exec -it ADB adb shell input keyevent KEYCODE_WAKEUP

To wake up my Nvidia Shield with the use of ADB that i have in an other docker container.
(It is fully possible to run the command in the web terminal)

Correct, Hass.io is a bunch of running Docker containers. The SSH add-on and Home Assistant run all in different containers. Executing a command inside the Home Assistant container is not the SSH container.

Yep, you can run an SSH command in the Home Assistant container using a shell command. Using that, you can execute commands with the SSH add-on. This requires some fiddling with public/private keypairs to allow Home Assistant to SSH into the SSH add-on and execute commands.

Could you maybe show an example or is someone already doing this? Advanced beginner here…


I am using Hass.IO and I want to create a switch to SSH into my Mac to eject volumes and USB-drives and then shut it down. SSH login without password is already working, by following this tutorial.

If I use your Addon I can SSH into my Mac and shut it down (without being asked for a password) using this command:
ssh [email protected] 'shutdown -h now'

And this is the command I want to use to eject my USB-drives:
osascript -e 'tell application "Finder" to eject (every disk whose ejectable is true)' (I am not sure how to use this with SSH tbh…)

Or is there an easier way to get this working?

Found this tutorial on how to use SSH on Hass.IO to control other devices: A thorough guide on controlling anything SSH with Homeassistants’s Hass.io

Everything I wanted is working as expected. Just wanted to drop the link, in case someone is looking for the same.

My setup:

script:
  macbook__standby:
    sequence:
      # Eject Time Machine
      - service: shell_command.macbook__eject_timemachine
      - delay: 
          seconds: 10
      # Macbook to Standby
      - service: shell_command.macbook__standby

shell_command:
  macbook__eject_timemachine: ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] 'diskutil eject /Volumes/Time\ Machine'
  macbook__standby: ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] 'pmset sleepnow'

switch:
  - platform: wake_on_lan
    name: WoL  Macbook Switch
    mac_address: !secret switch__wol__macbook_mac_address
    host: !secret switch__wol__macbook_host
    turn_off:
      service: script.macbook__standby
2 Likes

This helped me to finaly understand what i had to do to make this work.

1 Like

:tada: Release v3.6.0

This release updates a couple of things, but adds some new things as well!

The Home Assistant Command Line Tool has been added and yamllint is now available as well! :tada:

Full Changelog

  • Upgrades bind-tools to 9.12.3-r0
  • Upgrades nginx to 1.14.1-r0
  • Adds Home Assistant CLI
  • Updates README to list the hass-cli
  • Adds yamllint

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck or https://buymeacoff.ee/frenck

:tada: Release v3.7.0

This release consists mainly of updates of packages and documentation. The big change is the Hass.io Command Line tool, which has gotten a major upgrade!

Full Changelog

  • Upgrades sqlite to 3.25.3-r0
  • Removes BountySource links
  • Removes Anchore.io links
  • Updates maintenance year to 2019
  • Replaces add-on link with GitHub link
  • Moves Python requirements out of the Dockerfile
  • Configures Renovate (#50)
  • Updates hassio-cli to v2.0.1 (#51) (@timmo001)
  • Refactor of GitLab CI
  • Upgrades add-on base image to 2.3.1

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck or https://buymeacoff.ee/frenck

1 Like

I’m using this addon in an iframe panel and scroll back with my trackpad seems to be very sensitive; is there any way to dampen this at all?