MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.91k stars 499 forks source link

myMPD: no access to music directory when mounted via Samba using dietpi_drive-manager #7172

Open cbrenberg opened 4 months ago

cbrenberg commented 4 months ago

Creating a bug report/issue

Required Information

Additional Information (if applicable)

Steps to reproduce

On a system running MPD with a music directory located on a Samba share that was mounted using dietpi_drive-manager:

  1. Install and configure myMPD, MPD, and Samba Client from dietpi-software
  2. Mount a music directory over Samba/CIFS using dietpi_drive-manager
  3. Set the MPD music directory to the local mount point in mpd.conf
  4. Set myMPD to autodetect the MPD music directory over the mpd socket

Expected behaviour

Actual behaviour

Extra details

I was able to resolve this on my system by editing the permissions for my music directory mount in 'etc/fstab' from 0770 to 0774.

Other possible solutions would be to assign mympd's systemd user to the 'dietpi' group when it's created or to add additional options within dietpi_drive-manager to override the default user/group/permissions that it writes to /etc/fstab

MichaIng commented 4 months ago

Is it actually the mympd user which requires access, and not the mpd user? I know that myMPD has some additional features on top of MPD, which do allow filesystem access, but I remember also that I discussed this exactly with its author, and that access to /var/lib/mympd was all that is needed. Or we were talking about write access only, not 100% sure. The mpd user should be member of dietpi group already.

However, as you also mentioned to set the Samba mount point as MPD directory and auto-detect it via MPD socket, it does not make much sense the myMPD requires access directly. Please verify this works as well:

chmod -R 'o-rwx' /path/to/mount
useradd -rMN -g dietpi -d /var/lib/mympd -s /usr/sbin/nologin mympd
cbrenberg commented 4 months ago

Thanks for the reply. chmod doesn't throw any errors, but the change does not take effect when run against a samba mount, which is what led me to modifying the permissions in my fstab file to fix it.

This discussion in the myMPD repo describes the same exact symptoms I was experiencing in the myMPD UI, which makes me believe that the mympd user requires read access to the MPD music directory. The mpd user already had access via membership in the dietpi group: https://github.com/jcorporation/myMPD/issues/1303#issuecomment-2143989726

MichaIng commented 4 months ago

Seems you are right. Still not sure how to solve best if we want to keep the dynamic user. Maybe it can be still given dietpi as supplementary or primary group. I'll test.

jcorporation commented 3 months ago

I would prefer this, as documented in the myMPD documentation:

mkdir /etc/systemd/system/mympd.service.d
echo -e '[Service]\nSupplementaryGroups=dietpi' > /etc/systemd/system/mympd.service.d/music-group.conf

Using a smb mount as music directory has some disadvantages. For example I noticed that filenames with a colon in the name are not supported, a NFS mount is preferable in my opinion.