Also, I should be testing from the homeassistant container, not the supervisor container… correct? Still learning and have a ways to go.
I am a network engineer at a major university, but I am not a linux admin!
Ok, you are running hassio. I thought you were just running HA in a docker container. I am not using hassio, but if you get past the 2222 port issue, the rest should work fine.
I am out of time until Sunday, will keep at it. Maybe I can set the port on HA to the non-standard and leave the base os at standard.
Correct. I love Hassio on Home Assistant. Have been running that way for a couple of years on the pi.
Ok, good luck! I can confirm that the commands work after you get the port issue solved. I am also running a similar command, and after using the sshpass, I got everything working just fine.
I tried hassio and I really liked the addons etc, but I am using a lot of custom components I have made myself, and its easier with just the docker version for this reason.
Maybe try the ssh:// protocol option?
Try just
ssh ssh://username@ipadress:port_number
Changing port numbers now… just rebooting the system.
Dangit, made the port number changes and from the hassio container cli, I still get command not found!
bash-5.0# docker exec addon_40817795_nut upscmd -u nut -p XXX drups test.battery.stop | sshpass -p pm9600,sa ssh [email protected]
bash: docker: command not found
Pseudo-terminal will not be allocated because stdin is not a terminal.
no change with sudo either.
you forgot the echo
command
echo 'docker exec addon_40817795_nut upscmd -u nut -p XXX drups test.battery.stop' | sshpass -p pm9600,sa ssh [email protected]
And you will need the sudo
So, I think I have the port thing worked out. The base system is on port 22 and the hassio install is on port 2222. SSH to both works fine from outside of the system now. I also think I have the command line right:
echo 'sudo docker exec addon_40817795_nut upscmd -u nut -p xxx drups test.battery.stop' | sshpass -p xxx ssh [email protected]
It attempts to run the command, but spits out the following complaint:
Pseudo-terminal will not be allocated because stdin is not a terminal.
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 5.3.0-28-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
* Multipass 1.0 is out! Get Ubuntu VMs on demand on your Linux, Windows or
Mac. Supports cloud-init for fast, local, cloud devops simulation.
https://multipass.run/
* Canonical Livepatch is available for installation.
- Reduce system reboots and improve kernel security. Activate at:
https://ubuntu.com/livepatch
33 packages can be updated.
0 updates are security updates.
Your Hardware Enablement Stack (HWE) is supported until April 2023.
sudo: no tty present and no askpass program specified
I should add that:
sshpass -p xxx ssh [email protected]
Works and gives me a prompt on the base system.
The command:
sudo docker exec addon_40817795_nut upscmd -u nut -p xxx drups test.battery.stop
works once the sshpass is issued. It does ask for a sudo password. Is this what is hanging me up?
I think I am closing in on it, but could be way off base.
I got it to work!
I had to add my user as a sudo user without password to the sudoer file, and it had to be on the end of the file in Ubuntu or it did not work.
Now I need to wrapper that down to only allow the docker commands for that user without a passwork.
Working command:
echo 'sudo docker exec addon_40817795_nut upscmd -u nut -p xxx drups test.battery.stop' | sshpass -p xxx ssh [email protected]
Thanks for all the help!