danb35 / freenas-iocage-plex

Scripted installation of Plex Media Server in a FreeNAS jail
GNU General Public License v3.0
56 stars 9 forks source link

Enable modifying the uid and gid that the plex user runs as #8

Closed YodaDaCoda closed 3 years ago

YodaDaCoda commented 4 years ago

I have my media readable to group media with gid 1000. It'd help to add something to either change the default user's group, or add a new group and attribute it to the default user.

# change the gid of the plex group
pw groupmod plex -n plex -g $GID
# change the uid of the plex user, and ensure they're linked to the correct group
pw usermod plex -n plex -u $UID -g $GID
# take ownership of the plex user's config files
chown -R plex:plex /config
danb35 commented 4 years ago

I don't think I'd be inclined to be changing the UID/GID for the plex user/group respectively--those are set by the package installation, and they're expected to be what they're set to. However, either of these might help:

Ornias1993 commented 4 years ago

@danb35 I debated changing the run-as users myself for my scripts too last week. Decided against it, because it would make it harder and harder to provide support...

My solution is normally just to add those users to the media group everywhere and be done with it. It should be a PR of one line to just add them to a group and be done with it.

YodaDaCoda commented 3 years ago

This guide has setup scripts for a number of different applications including Plex. While its Plex guide doesn't include modifying the user, most of the other guides do. Turns out that if the user that the package creates upon installation already exists, it's just used as-is. This means you can create a plex user with the requisite uid/gid before package installation, and it'll Just Work :tm:. It's certainly working for me without issue.

SERVICE_USER=plex
SERVICE_USER_ID=1000
SERVICE_GROUP=plex
SERVICE_GROUP_ID=1000
pw group add "${SERVICE_GROUP}" -g "${SERVICE_GROUP_ID}"
pw user add "${SERVICE_USER}" -u "${SERVICE_USER_ID}" -g "${SERVICE_GROUP_ID}" -d /nonexistent -s /usr/bin/nologin
Ornias1993 commented 3 years ago

@YodaDaCoda I dont get the usecase: if you need plex to be member of a group them add it to said group.

Dont go hacking just because you want plex to be member of gid 1000, add it.

YodaDaCoda commented 3 years ago

I also want plex to be uid 1000. Which I can achieve by executing the appropriate commands, sure, but it helps to create the user as required rather than modifying the user and running chown on a bunch of stuff.

Ornias1993 commented 3 years ago

I also want plex to be uid 1000. Which I can achieve by executing the appropriate commands, sure, but it helps to create the user as required rather than modifying the user and running chown on a bunch of stuff.

If you want something that has no sane usecase, you know you can just build your own jail right? These scripts are meant to be a support for the majority of people that want to run their own jail but not bother too much with figuring out everything themselves. If you want to have all sorts of tweaks, that have no sane usecase... I think thats the time to go do it yourself.

Note What I eamnt with "no sane usecase" is the fact your previously stated usecase, didn't fit what you are requesting and you haven't come up with a beter explaination as of yet.

YodaDaCoda commented 3 years ago

Thank you for your opinion.