Permissions in conf folder for use with git

I wish to use git to track changes I make to my OH2 configuration. Because I am running git from my login user (not the openhab user, I have changed the permissions for the conf directory and all files in that directory to 775 (drwxrwxr-x), and added my login user to the group openhab. Is this a bad idea for some reason? Will openhab change the permissions back to 755, removing write access for the openhab group and therefore my login user running git?

Other details: I did a manual install of OH2, so everything is contained within /opt/openhab2/, I am running this on a Pi3

Nothing wrong with this as far as I can see. you could use 765 if you set the Group on the files to openhab instead of your login but…

Yes, it will.

I also keep all my OH configs in git as well and frankly, I solved this permission problem the cheesy way. I run the git commands with sudo. I had to add my git ssh key to the root user but that wasn’t too much of a pain.

Were I to do this properly I would probably checkout and run the git commands as the openhab user (sudo -u openhab git add .) but I run OH in a Docker container and the openhab user on my host doesn’t have a home directory so I’ve no place to put the ssh key. I could create and configure a home directory but it was easier for me at the time to just configure root and run the git commands as root.

Why? On a RPi apt-get or openHABian is so much easier to install, run safely, keep up to date, and manage. Also, when asking questions on this forum, it is a whole lot easier for us to help because we can make assumptions about how your OH is set up and be much better able to help you.

The group on the files remains openhab. I simply added my login to the openhab group.

When does this happen? I have restarted OH2 many times now and the permissions remain 775.

These are some good points. The main reason is that I wanted everything in one place to get a handle on which files are where, etc. I came from OH1.8 which was similarly installed. I imagine it should be easy enough to install the apt repo version and simple copy everything over (fixing the few exec rules which have paths that ought to be migrated). Any hiccups I should watch out for when moving from a manual to apt install?

The start script goes through all the files OH needs and changes their permissions to openhab:openhab 665. Perhaps they have modified the scripts to use 775 now. Or maybe that is a difference when running the manual install. It would make sense because with the manual install they can’t assume there even is an openhab user let alone that the user is running OH as that user.

Mostly just file permission stuff and the locations of files are different. Don’t put the scripts that you exec in the /etc/openhab2/scripts folder as the file permission changes discussed above will strip the execute bit off the permissions. Better to put them in some other folder in /etc/openhab2 or in ~openhab/scripts which will be /var/lib/openhab2/bin for an apt-get installation (NOTE: you have to create this bin folder).

If you are starting over from scratch on this Pi I highly recommend openHABian as it has scripts to install and configure all the other stuff that lots of people use alongside OH like Mosquitto, InfluxDB, Grafana, samba share to your conf folder, etc.

FYI: looking through the <OH Install Directory>/runtime/bin/karaf file, I can’t find any instance of chmod, so I assume the start script on the manual install doesn’t change permissions. Can you confirm the start script from an apt install of OH2 does change permissions?

I can confirm that it does change permissions in the Docker container. I can confirm that at least as late as version 2.1 release it does.