I resume this old post because I was in the same situation:
NTFS usb disk used with nextcloud docker (I know this is NOT the ideal solution but I was forced to use this filesystem)
udevil mounts automatically with fmask=0133 and You can't change this behaviour because /etc/udevil/udevil.conf is in the read only part of the fs
check_data_directory_permissions => false on nextcloud config is not the solution because user nobody doesn't have rights to write into the disk
my solution was to make a udev rule to exclude standard udevil mount for only my particular disk and mount it using my parameters
steps to reproduce it:
1) copy real udev to the storage part
2) modify this rule (in my case I wanted to do something different for every disk with label starting with string "Max")
# dont run in "installer" mode
IMPORT{cmdline}="installer"
ENV{installer}=="1", GOTO="exit"
# check for blockdevices, /dev/sd*, /dev/sr*, /dev/mmc*, and /dev/nvme*
SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*|nvme*", GOTO="exit"
# check for special partitions we dont want mount
IMPORT{builtin}="blkid"
ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit"
# /dev/sd*, /dev/mmc*, and /dev/nvme* with partitions/disk and filesystems only, and /dev/sr* disks only
KERNEL=="sd*|mmc*|nvme*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem",ENV{ID_FS_LABEL}=="Max*" GOTO="harddisk_special"
KERNEL=="sd*|mmc*|nvme*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem" GOTO="harddisk"
KERNEL=="sr*", ENV{DEVTYPE}=="disk", GOTO="optical"
GOTO="exit"
# mount or umount for hdds special rule ntfs rw with nouser
LABEL="harddisk_special"
ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl restart udevil-mount2@/dev/%k.service"
ACTION=="remove", RUN+="/usr/bin/systemctl stop udevil-mount2@/dev/%k.service"
GOTO="exit"
# mount or umount for hdds
LABEL="harddisk"
ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service"
ACTION=="remove", RUN+="/usr/bin/systemctl stop udevil-mount@/dev/%k.service"
GOTO="exit"
# mount or umount for opticals
LABEL="optical"
ACTION=="add|change", RUN+="/usr/bin/systemctl restart udevil-mount@/dev/%k.service"
GOTO="exit"
# Exit
LABEL="exit"
Display More
3) make a copy of service udevil-mount
cp /usr/lib/systemd/system/[email protected] /storage/.config/system.d/udevil-mount2@.
service
4) modify service as follow
[Unit]
Description=Udevil mount service
[Service]
Type=oneshot
ExecStart=-/storage/bin/mount_special_disk %I
ExecStop=-/usr/bin/udevil --umount %I
ExecStartPost=-/usr/lib/samba/samba-autoshare
ExecStopPost=-/usr/lib/samba/samba-autoshare
RemainAfterExit=yes
5) create /storage/bin/mount_special_disk
#!/bin/sh
disklabel=`/usr/sbin/blkid -o value -s LABEL $1`
mkdir -p /media/$disklabel
/usr/bin/mount -t ntfs -o nosuid,noexec,nodev,noatime,big_writes,fmask=0022,uid=65534,gid=100,utf8,permission $1 /media/$disklabel
6) make script executable
and that's all; every time a disk with label starting with "Max" is attached (I have 2 disks Max1 and Max2 all of them NTFS) it will be automounted in the same place of before, but with modified options so Nexcloud (or any other docker instance) can write to
those scripts are far from ideal but they works, at least for my puposes...
Display MoreThe Nextcloud data directory must have 0770 (rwxrwx---) permisions as shown in that same error page you got. What it doesn't say there is that the data directory also must be owned by nobody.users (65534.100) so Netxcloud would be able to access it.
By default Libreelec (udevil) automounts the usb storage as 777 (rwxrwxrwx) root.root but Nextcloud runs as user nobody.
The external storage is automounted with udevil and whose config file is /etc/udevil/udevil.conf that is located in the read only part of the file system and doesn't seem to be possible to override the default_options_ntfs to change the user and group it automounts the hdd with.
default_options_ntfs = nosuid, noexec, nodev, noatime, big_writes, fmask=0133, uid=$UID, gid=$GID, utf8
to:
default_options_ntfs = nosuid, noexec, nodev, noatime, big_writes, fmask=0133, uid=65534, gid=100, utf8
You could try to disable that permission check at boot in:
/storage/.kodi/userdata/addon_data/docker.linuxserver.nextcloud/config/www/nextcloud/config/config.php with:
'check_data_directory_permissions' => false,
but that won't work because of the fmask=0133 that makes all files readonly for non-root users.
Anyway I've not tried changing udevil.conf and I'm not sure if this would be enough for Nextcloud to have the whole data directory in an NTFS (or exFAT) drive since neither support unix type permisions. Also won't recommend messing with udevil config unless you know what you are doing.
The other (dirty) option to try would be to unmount and remount the device with the required permissions. A background script launched from /storage/.config/autostart.sh could periodically check if these are correct and unmount and remount when required, but again not sure if will work with NTFS or exFAT..
Alternatively you also can easily share an NTFS formatted disk in Nextcloud just sharing it via the own Libreelec samba server and adding it via the external storage app, with a similar result to using the -v /var/media/My\ Book:/My\ Book parameter in the addon's additional config page but still the users folders will be kept inside the container's original data directory, which may not be what you want.