Scripts are run by?

With Openhab, I had a small script in ‘/scripts/ringDoorbelNormal.sh’ that triggered a command on another server to ring my ip-phones. This went fine.

With OH2, the script is being triggered but not executed properly.

In the script, /etc/openhab2/scripts/ringDoorbelNormal.sh, I’m having now:

touch /tmp/ringtest.txt
sshpass -p 'MYPWD' ssh MYUSER@REMOTESRV /scripts/ringPhonesNormal.sh

The file in tmp is being created, and i’m getting an entry in my log for the script:

../logs/openhab.log:2016-10-04 17:22:13.377 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine '/etc/openhab2/scripts/ringDoorbelNormal.sh'

But no phones do ring. When I run it manually from cli, the phones start ringing.
Is it possible that this is an problem with the user that runs the command?

Guess the problem is related with the user.
If I’m not wrong, the user that’s been used is openhab.
So I guess I’ll need to add the ssh keys of the other servers to the openhab profile. But it seems that the openhab user doesn’t has a password, and for that, I can’t change (su - openhab) to that user?

Any suggestion?

To get a shell running as the openhab user run:

sudo -u openhab /bin/bash

But you can also just copy the contents of your .ssh folder to ~openhab/.ssh and then, as root, chown -R openhab:openhab ~openhab/.ssh.

Works just perfect!
Thanks!!!