Dear community members,
my openHab 4.1.1 runs in a docker environment on an Openmediavault 6 server (OMV6). From time to time I update my items and things files over the Windows SMB share. For this purpose I have exported the docker volumes of the openHAB container and made them abailable via windows SMB on the network. Sometimes I get access problems on the openHAB files and I tracked it down to the specific user/group which is used when starting the docker container.
My setup:
On my OMV setup I have a specific user for docker with name docker1 (ID: 1002) and membership in group users (ID: 100). In OMV6 a dockercompose file is used to handle the container. It looks like:
services:
openhab:
image: "openhab/openhab:4.1.1"
restart: always
network_mode: host
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
# config in SMB folders
- "/srv/dev-disk-by-uuid-9e2c512c-33d2-4a6a-aa1b-e10a5f6eea6a/openhab_addons:/openhab/addons"
- "/srv/dev-disk-by-uuid-9e2c512c-33d2-4a6a-aa1b-e10a5f6eea6a/openhab_conf:/openhab/conf"
- "/srv/dev-disk-by-uuid-9e2c512c-33d2-4a6a-aa1b-e10a5f6eea6a/openhab_userdata:/openhab/userdata"
environment:
CRYPTO_POLICY: "unlimited"
EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"
OPENHAB_HTTP_PORT: "8180"
OPENHAB_HTTPS_PORT: "8543"
PUID: 1002
PGID: 100
The folders outside the container usually have the following permissions:
drwxrwsr-x 2 root users 4096 25. Feb 11:25 openhab_addons
drwxrwsr-x 14 root users 4096 23. Feb 17:20 openhab_conf
drwxrwsr-x 12 root users 4096 24. Feb 18:18 openhab_userdata
With ps aux | grep openhab I can see, that the docker is started with the user openhab (ID: 9001), which is usually the standard openhab user in an openhab group (ID: 9001):
9001 2768061 1.2 4.5 8012960 722312 ? Sl Feb24 13:02 /usr/lib/jvm/java-17-openjdk-amd64/bin/java …
This is causing from time to time a change of the owner / group of the container volumes to
drwxrwsr-x 3 9001 9001 4096 23. Feb 17:56 openhab_addons
drwxrwsr-x 14 9001 9001 4096 23. Feb 17:20 openhab_conf
drwxrwsr-x 12 9001 9001 4096 24. Feb 18:18 openhab_userdata
This is very annoying because I cannot access these volumes over windows SMB anymore with my users which are in the users group of OMV. If I change back the owner / group to root / users and do a chmod 775, everything will work fine again.
As you can see from above, I am trying to force openHab in the dockercompose file to start with user docker1 (ID: 1002) and group users (ID: 100). But obviously the container is started with user 9001.
What do I need to do to start the openHAB with my docker1 user?
Will this solve the windows SMB access problem?