How to use z-wave binding without starting openhab as root

Hi There,

can someone explain me, why the z-wave binding can only access the usb dongle when starting openhab as root? I don’t think that’s a great Idea doing this.


You are correct that running openHAB server as root is a bad idea. Depending on your OS, you should instead give permission for a normal user to access the port that the USB device is attached to. On Raspian and other Linux distros, for example, you would add the user to the dialout group, as described here:

sudo usermod -a -G dialout openhab

On Centos 7 it was not enough as the openhab user was not able to create the /run/lock file necessary to obtain control over usb.

"FATAL: cannot lock /dev/ttyUSB0: Permission denied"

The solution was to add openhab user to lock group and make lock directory group accessible.
As this directory is recreated at boot it was necessary to edit /usr/lib/tmpfiles.d/legacy.conf and change

d /run/lock 0755 root lock -


d /run/lock 0775 root lock -