… but this is a solution for hassbian. When i log into ssh, run moboSSH and reconnect - everything works fine.
The script for shutdown is:
test_name: ssh -l windows-user 10.10.10.220 “shutdown -r now” (eg. 10.10.10.220 is an IP for my PC. Connection test passes so my data (username + IP) are correct)
When I try to open MY script for restart WindowsWITHIN Hass.io - nothing happens (no errors, nothing). It’s strange because when I use the sequence in Putty - this script works and Windows is rebooted…
What’s going on? Maybe Hassio has different method for running shell scripts? Please help…
I can’t speak to SSH to shutdown windows, but what I used was PSTools since my HA is running on a windows server, I was able to create a .bat file on the server that HA then calls psshutdown to remotely sleep any of the computers in the house.
I realize that this probably doesn’t exactly help you, as I don’t think there is a linux alternative to PSTools, but someone else may come along and be looking for a way to do this from windows -> windows
Thanks guys I thing this post “A thorough guide on controlling anything SSH with Homeassistants’s Hass.io” has all the answers, but after 3 tough days of fighting with SSH I’m stuck in connecting to port 22222 (port 22 works perfectly). I did everything just like in tutorial. I’ve created private / public keys and sent public key as name: authorized_keys inside root in SD Card (I guess this is roob - inserting my SD card in my PC shows only some files like boot, config etc and one folder Overlays - drive name hassos-boot. Some other people shows images with more folders. Maybe I don’t see everything). This public key authorized_keys has been copied good from Puttygen - there is no problem there).
After reboot Raspberry Pi I am still not able to open port 22222 (port 22 works well, as I mentioned before). Maybe I didn’t see the good root directory on SD Card? I don’t know I’m confused
I’m not sure why you need to use port 22222. I’m pretty sure that’s the port the guy in the tutorial had set up for ssh. If your ssh works on port 22 then use that port to do the tutorial with .
Also there is no reason to pull your SD card out to do anything in the procedure. It’s all done on an active machine thru ssh.
The guide is outdated in terms of describing what to do with authorized_keys. With HassOS, you need to put that same file on a USB stick, not the SD. Also with HassOS, you can have Hassio up and running for this particular import.
The USB needs to be named “CONFIG” (yes, caps). Put the authorized_keys file on it, then insert it into the pi.
In the UI, go to hass.io > system and click on “import from USB”. You can refresh the logs below on that same page to see that the config has been imported. Then you should immediately be able to ssh as root using 22222, no restart or reboots are needed.
Thanks guys again. Today “by accident” I’ve found this threat New Hass.io images, based on HassOS that discuss this structural changes. It’s good to know (after 3 hard nights) that I’heading in the wrong direction.
I’ve placed my public key in usb and import all in hassio panel and… Works
So… One problem solved. Now there is another. After connecting to port 22222 I try to use command “docker ps” and it says “docker is not hassio command.”. Very frustrating. What to do next?
Btw I tried a plugin called RPC Shutdown (sorry if I mispelled this) but this doesn’t work either.
You then also need to type login before the docker command to login to the host… I have no idea why but when you first login you can only access hassio commands until you login…
@DavidFW1960 How can I do this? After login to port 22222 what do I need to type? I connect using Putty as root@ipaddress and port 22222 with private/public key
Have you tried looking into the command_line switch? I used that to turn off my PC through HASS.IO until I discovered the RPC Shutdown add-on. Never had use of reboot, but I know it was possible through the command_line switch
Hmm. I don’have that login prompt twice. After connecting to port 22222 using SSH i write root once and then in command line i type docker… And it wont work.
@WonderMoose i’ve tried RPC Shutdown but it doesn’t work either (I made serious changes in win 10 like disabling firewall and changing registry but no luck using this method).
Still - I would like to have possibility to do every other shell prompts also, not just reboot…
When you log in using ssh to port 22222 you have to use the authorised keys file and you don’t enter anything in for login (at least I don’t) maybe I have that set in my connection. In any case, when you get a command prompt in the terminal, look at the text on the screen and that tells you that you need to login for the host (I think) so on that screen type login and press enter and you can do the docker stuff. Are you sure you are using port 22222 and not 22?
Thanks. Yes I’m sure about the ports because i fought with this for 3 nights now… I will try to apply what you said in couple of hours and give you fedback. I would like to thank everyone for sharing knowledge and time for this problem to be solved
UPDATE: I’ve found a little trick to create user in Windows 10 and pass 1.2 SLAVE part with success. I just create new username inside Windows Control Panel and create password. In C:\Users\newUsername I’ve created folder .ssh and placed all public keys. I was able to do this using SSH also, but this methods works the same.
*Important - try not to create username with latin characters like śćłó and so on. Since my admin name is having one of the character - I’m unable to create and open files in my Windows 10 folder using Putty.
Three problems solved. Now I’m stuck on removing password:
“You will probaly be interested in running some commands with sudo without a password. For this we will need add these lines to /etc/sudoers file.”
Then in tutorial is sudo visudo command. It doesn’t work for me… Maybe I am on bad ip or port?
Please take a look at this img (login to user brostudio correct but it stopped in one place) Hassio login
I cannot login using ssh while I’m in docker also. maybe this is the issue? Please help
ssh [email protected] trying to connect using port 22 and no luck
I tried to remove password in brostudio username also, but no luck SSH login from docker