Hello, I would like to shut down unRAID via openHAB.
For this I have installed sshpass on the Raspberry.
If I now execute the command via SSH, unRAID shuts down.
I have now packed the command in a .sh file, however, this does not work. Do I have an error somewhere?
When called from the command line or when called from openHAB? If it doesn’t work from the command line it’s never going to work anywhere. If it works from the command line, what happens when you run it under the openhab user?
Note that when it’s run from openHAB, ssh and sshpass might not be in the path. Use the fill path to those commands.
The command exactly as it appears in the Thing config is the only thing that needs to be whitelisted.
Do you have a link with instructions? Have not found anything.
From the command line. When I am logged in to openHAB via SSH (openhabian) and send the command, it works.
But when I want to run the command as user openhab it does not work.
I think this is the problem.
How can I give the user openhab the permission to do this?
I think that should be correct. The entry looks like this:
2023-03-14 12:04:46.376 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Error occurred when executing commandLine '[/etc/openhab/scripts/AZ_UnRAID_Shutdown.sh]'
java.io.IOException: Cannot run program "/etc/openhab/scripts/AZ_UnRAID_Shutdown.sh": error=13, Keine Berechtigung
The permissions of the .sh file look like this:
Update:
I changed the permission, now I don’t get any error in the log either.
However, the server is not shut down.
use the version that returns loggging output and write that logging to your openhab.log file
var ScriptResponse = executeCommandLine(Duration.ofSeconds(5), "/etc/openhab/scripts/AZ_UnRAID_Shutdown.sh")
I think the problem is that the ssh process insists on prompting for the key fingerprint of the server that you want to login. This also will be the case when certificates will be used…
This should be the result of the returned output of executeCommandLine.
This will ignore the fingerprint of the remote host.
If you would like to continue with secure connections you would have to make sure that the openhab user has a .ssh sub-directory in its home directory and a file known_hosts that contains a line with the fingerprint of the remote host.