Mopidy as a service -- folder permissions


#1

Hello,
I am setting up mopidy to run as a service, and had a very hard time making the local and media work.
First the media folder needs to be readable by the mopidy user, which seems straightforward, but isn’t stated in the documentation. But this is not enough, since the folders containing media files needs to be executable by mopidy, which isn’t stated anywhere, nor said in the output of mopidyctl local scan, the only thing appearing is that x errors occured.

Please update the documentation so that people can set up mopidy by themselves.


#2

Thanks for the feedback.

From https://docs.mopidy.com/en/latest/service/#mopidy-user

The mopidy user will need read access to any local music you want Mopidy to play.

Is there somewhere else you think we should mention this?

The executable bit of a directory does not mean the same as for a file (as it makes no sense). The execute bit on a directory allows you to access items that are inside the directory, even if you cannot list the directories contents. It’s not stated anywhere in our documentation since it’s a fundamental part of Linux. But you are right, we could mention that. In the documentation at least. So, just like your first point, do you have a suggestion where it should go?

A PR would be welcome.


#3

The execute bit on a directory allows you to access items that are inside the directory, even if you cannot list the directories contents. It’s not stated anywhere in our documentation since it’s a fundamental part of Linux.

Oh I’m sorry I thought this was something mopidy specific, I didn’t know about the meaning of executable dirs. I think it could go in the Running as a service > mopidy user part in the documentation, right after the part I said wasn’t there…

I think it could be good to provide a command to run to change owners and permissions of the folder containing media, so as to give easy setup instructions, since managing files for other users is not something most people do on a regular basis (I use linux regularly, but never encounterd the need to make a folder executable… I realise creating a directory makes it executable by all by default, I guess that scp messed with my files permissions when copying them…)

Like chown -R mopidy:audio /home/MediaDir
so that if the user is in the audio group both mopidy and the user can access the files
(that how I did it, but maybe doing it the other way around user:mopidy would be better,
so that we wouldn’t need to add the user to the audio group ?)

then chmod -R ug+rw /home/MediaDir
and find /opt/lampp/htdocs -type d -exec chmod ug+x {} \;
to set only the directory executables.

I will make a pull request when we agree on something, I’m sorry if I was aggressive, I spent hours trying to debug this…