Close

OpenHAB: The importance of the correct file owner

I started my own home automation journey a while ago. Unfortunately I rarely use my time to actually work on my setup. As you can obviously see from the title I’m using openHAB for bundling different home automation systems and use them together. As for today I do not use any other components but Homematic, but I’m well prepared. And the openHAB solution brings also some other features I plan to use.

But enough about what my setup is and what my plans for the future are, let’s come to today’s topic. As you manage openHAB, the basic administration works with special files in special folders within the programs directory in /etc. First of all I managed to bring all components I have in the Homematic system into openHAB. This worked fine and I was able to make all components accessible via the openHAB app. Additional to that very basic feature I wanted to automate the roller shutters on the north-west side of our house to go down when the sun shines directly into them. For that case openHAB brings the possibility to write rules in a when-then-end scheme.

My first approach was to build a simple cron job to execute the rule at a specific time. The script was written very easily and saved as roller_shutter.rules into the rules folder within the openhab2 directory. But it would not work. A fast look into the log did say that the file couldn’t be opened. Remembering other access issues in the past I quickly set the permissions to 777. But it didn’t work. The file was still not accessible. I checked all the other permissions for parent folders but still didn’t see any results. I also tried to alter the rule itself but again with no improvement. After a lot more tries I resigned eventually and looked for help in a openHAB online forum. After a couple of ideas, also focused on the permissions as my first approach, it fell like scales from my eyes. I checked the file owner and suddenly knew what was wrong. I created the file from my Windows computer but the access to the server was done by my standard user. So the owner of the file was, exactly, my standard user. But in order to access and execute the file correctly it should have been the openhab user! Now a quick chown changed the owner and blew all of the issues away. The access was no problem anymore. That a pity…

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2024 NOD_BLOG | WordPress Theme: Annina Free by CrestaProject.