i have experienced permission issue while trying to use openhab with exec binding
first of all you can always check the permissions by “sudo -u”.
For example
sudo -u openhab /usr/bin/python /home/pi/testscript.py
to guarantee fixing the permissions issue of openhab, i did a couple thing, all of them were needed
you should also do these steps
1-) copy your scripts to /etc/openhab2 folder, and use them there if possible
2-) grant scripts permissions like this
sudo chown openhab testscript.py sudo chmod 777 testscript.py sudo chmod a+x testscript.py
3-) edit config file and change user and usergroup to root from openhab
sudo nano /etc/default/openhab2
OPENHAB_USER=root OPENHAB_GROUP=root
4-) add openhab user to sudoers
sudo adduser openhab sudo
5-) open this file with
sudo visudo
and edit this like the example below
openhab ALL = NOPASSWD: /usr/bin/python, /usr/bin/sh
6-) restart openhab service after all these steps
sudo service openhab2 restart