TLDR: I want to change default permissions of any Plex created file from -rw-r–r-- to -rw-rw-r–
I am running plex as a docker on unraid. For those who aren’t aware, unraid typically will use the user “nobody” with group “users” for any file created. Naturally I have set the PUID and PGID such that the docker creates files using these credentials.
The problem that I am running into is that any file created by Plex (either the DVR or Camera Upload) is created with the permissions:
-rw-r–r-- 1 nobody users
Unraid relies on group permissions in order to allow other users on the server (I have two accounts) to read/write. Since the file is created with read-only group permissions, I am not able to modify or delete any Plex created file from those accounts.
Another post that seems to confirm this observation:
What are you trying to accomplish at the end of the day?
Sometimes there is more than one way to skin a cat if you don’t want to take the suggestion in the post you linked to.
I am trying to change the permissions on auto-generated files, such as the ones created by DVR or Camera Upload, so that they have group write permissions.
Yes I understand that however that may not be an option so what is your end goal and maybe there is an elegant solution to accomplish what you want to do.
@Matt_Treher said:
I am trying to change the permissions on auto-generated files, such as the ones created by DVR or Camera Upload, so that they have group write permissions.
The same way you are passing PUID=x and PGID=y you should be able to pass a -e UMASK=002 (or maybe 0002 - cant remember if it wants a 3 or 4 digit mask) value.
@nokdim said:
Yes I understand that however that may not be an option so what is your end goal and maybe there is an elegant solution to accomplish what you want to do.
I don’t believe there is. I have three user ids that are active on my system. One is used by plex, the other two are used by humans. I need the humans to be able to r/w on the plex generated files.
@trudge said:
The same way you are passing PUID=x and PGID=y you should be able to pass a -e UMASK=002 (or maybe 0002 - cant remember if it wants a 3 or 4 digit mask) value.
Unfortunately neither 002 or 0002 worked. But this is the general idea of what I would like to do. I tested this with changing the setting and then uploading a photo through Camera Upload. (I’ll kick off a DVR recording, but that will take a bit more time).
Don’t know anything about unraid or the Dockerized Plex situation and didn’t fully read the suggestions, but I just use the setgid bit so that all group write permissions are preserved for newly created files and directories under my television library.
You can also use posix acl for this purpose. I don’t use it on my server, but I use it for a multiuser environment, and it provides incredibly robust control over permission inheritance.
Here’s a good overview of the options:
Again, know very little about docker/unraid, but I’d think you’d be able to start the container in interactive mode: docker run -it <container> bash
and setgid on your television library directory (doing it recursively requires a find rigamarole). Or assuming this functions with a bind mount, try just setgid bit on the host directories and see whether it’s picked up by the container.
Crap, didn’t have it set up correctly, and it did require ACL to get working. If unRAID supports ACL, you can do something like this where R is recursive, d is defaults, and m indicates modify/add rule :
Where I have the setgid bit assigning the adm group for all newly created files and directories, I have and an ACL rule that sets rwX for the group on newly created files and directories. No umask required, but it obviously depends on ACL, which isn’t ideal.