Category Archives: Linux

fix file permissions issue openhab execbinding

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/

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
sudo chmod 777
sudo chmod a+x

3-) edit config file and change user and usergroup to root from openhab

sudo nano /etc/default/openhab2

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