Modification of config files is done on a PC/Mac which mounts the exported configuration directory. I am currently using the default user ‘pi’ to edit the files.
Now here is the problem: everytime openHAB is restarted, it restores the permissions of config files to 0644, which makes it impossible to edit the files as described.
The problem has been discussed over and over but there is no real solution (just search for setPermission).
Solutions so far
login as the openhab user ==> involves giving the openhab user a password, a shell and maybe more (did not try)
login as root ==> generally not the best idea. Also impossible right out of the box.
create a restart-skript, which firstly restarts openhab and then runs chmod o+w ... on the relevant files
ditch the designer and edit the config on the pi via a shell based editor
use dropbox or a similar tool to automatically sync the config
?
Now: how do you edit the config of a remote file? And: why does openhab insist on its chosen permissions?
I’ve modified the /usr/share/openhab/bin/setpermissions.sh to give write permissions to the openhab group (0664 for files and 0775 for directories). Then I added my login user (‘pi’, in your case) to the openhab group.
I ssh into my Raspberry Pi and edit the files locally, but this same change should also work for files accessed over Samba.
I don’t know why they don’t set group write permissions. I’m curious about that, too.
My config files are on 644, directories on 755, owner:group is openhab:openhab.
With the following smb.conf I am able to edit the files without any problems from my windows desktop:
[openhab_config]
path = /etc/openhab
available = yes
read only = no
browseable = yes
public = no
writeable = yes
force user = openhab
force group = openhab
create mask =0777
directory mask=0777
guest ok = no
I’m not a samba specialist, so maybe I have not the best security setup with this smb.conf, but it works
I was looking for something like force userand force group but I couldn’t find it. Thanks a lot! Does that work without giving the openhab user a shell in /etc/passwd?
Probably, but I upgrade much less often than I edit config files and it only takes a minute to edit the file. However, I think sihui’s suggestion is better since you’re using samba.
I would like to extend the basic question to scenarios where I want to remotely edit configuration from a PC which is not in the same subnet, e.g., from internet.
I can edit configuration using Paper UI and cloud access, e.g., https://home.myopenhab.org/paperui/index.html#
But how to edit configuration files my.items and my.sitemap using myopenhab without vpn access?
Thank you sihui. What I meant was: is it possible to edit configuration files from myopenhab like PaperUI settings? From internet, I can only access and edit configurations made by PaperUI. Config files like my.items are only editable when setting up additional tools like vpn oder NGINX.