Why does my openhab need Read right for others to process config files?


  • Platform information:
    • OS: Debian stable
    • Java Runtime Environment: java-1.8.0-openjdk-amd64
    • openHAB version: stable 2.3.0, apt installation

When files in /etc/openhab2/services do not have Read permission for Others, karaf says :

Could not process config file ‘mqtt.cfg’: /etc/openhab2/services/mqtt.cfg (Permission denied)

The rights on the directory and the example file :

drwxr-xr-x 2 root openhab 4096 Oct 21 11:50 .
-rw-r----- 1 root openhab 1538 Oct 21 11:50 mqtt.cfg

As this directory contains clear text passwords for connecting to services, I do not want to give a read permission to Others on the files (and this is not needed).

The question I can’t figure out is : with what user does it tries to access the file ? The main process runs as the user openhab.



Change the owner to openhab. I believe it will work. Right now your owner is ‘root’.

I am curious if that would work. If it does, then I believe you achieve what you are trying to do.

Hello Danny,

Thanks for your interest.

I’ve made more investigations today and it appears that openhab can read the file correctly with no permissions for Others, and files owned by root (i.e. just with read rights for the openhab group).

The logger reports “permission denied”, but openhab reads the file and takes it into account.

I come to the conclusion that a bug makes the logger report a false alert.



That makes sense. I was thinking the permissions were ok sometime i have had issues like this in the past with other programs.