1

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]

2
  • You say that you installed minidlna with the same username. The real question is whether it's the same UID. Does getent passwd minidlna return the same information? (Specifically in the third and fourth colon-separated fields.) Commented Sep 18, 2021 at 18:27
  • Hi Roaima, thanks for your input. I read around some sites and tried some troubleshooting a week or two ago and figured it was something like this, but I tried a suggested fix and didn't change anything. Alas, the full story was, trying to migrate from a small capacity microSD card to a larger one with possibly a faulty card reader destroyed my source, so the old card can't be booted for comparison. Sorry this is a bit vague.
    – David1618
    Commented Sep 19, 2021 at 8:39

1 Answer 1

2

The filesystem doesn't store usernames, it stores just the numeric UIDs. If the minidlna user is created with UID 123 on one system, and with UID 142 on another, then there'll be a mismatch if the filesystem is moved between hosts.

It's the job of the administrator to make sure that doesn't happen. I think Debian and Ubuntu create system users in order starting at UID 100, but if you've installed different software on the two systems (or the same software in a different order!), the UID numbers would not match.

Check the UIDs from /etc/passwd, it's the third field.

To fix your situation, you could remove everything related to minidlna on one of the hosts, then create the user with the same UID as on the other host, and then reinstall everything. Check that the UID you're going to use is free, of course.

E.g. if on host A minidlna is UID 123 and UID 142 is free, and on host B minidlna is UID 142 and UID 123 is used for something else, then do the renumbering on host A.

The same pretty much applies to any groups that might have been created along with the user. Check /etc/group, and the fourth field in /etc/passwd.

1
  • Hi ikkachu, thanks for the input. My comments to Roaima give a little more detail and I suspect my past troubleshooting stopped because I looked at user uid but not group. With that in mind, I'll try again later today, but note that the source is alas unbootable. Thanks again.
    – David1618
    Commented Sep 19, 2021 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .