I'm pretty sure this question is distribution and hardware neutral. I have a USB drive formatted ext4 with a directory (plus subs) configured for minidlna, owned root:minidlna with permissions 775. It was recently moved to a new installation, on which was also installed minidlna, using the same user name. Yet on this new install, minidlna cannot read contents of this directory. The hardware in each case is a Raspberry Pi 4 with Ubuntu server 21.04
(Furthermore, I have this directory's parent as the data directory for a Snap installed instance of Nextcloud, which accesses the directories as root, and I'm getting some permission denied issues with creating new files in existing directories - as root!! I suspect issues are related and when I understand why for minidlna, I'll understand for nextcloud snap.)
Following suggestions, I have checked:
id minidlna
returns uid 112 and gid 120 and ls -aln
returns matching gid of 120
drwxrwxr-x 17 0 120 4096 Aug 10 16:55 .
To make sure, I did chown -R 112:120
on the directory and still makes no difference. If I restart the minidlna daemon and then check its status, it is always (truncated)
minidlna.c:670: error: Media directory "/media/path_to/directory" not accessible [Permission denied]
minidlna
with the same username. The real question is whether it's the same UID. Doesgetent passwd minidlna
return the same information? (Specifically in the third and fourth colon-separated fields.)