Jump to content

Ubuntu Permissions - attempting to delete media from within emby


zachattack83

Recommended Posts

zachattack83

I apologize right now if this has been a frequent topic, but when searching the title, I end up with a whole lot of unrelated results...

Whenever I attempt to delete a duplicate movie from within Emby, it ends up telling me I do not have permission to do that.

I am running EMBY on a VM that is running Ubuntu Cinnamon. My file storage is on a vm running Open Media Vault. I connect the OMV VM to the Emby VM using NFS.

I have created an emby user on the OMV machine, as well as granted permissions to the emby user account to have rwx permissions.

Is there a guide available for setting up the linux permissions? Maybe I should have searched that more specifically... I'll try that in the mean time.

Link to comment
Share on other sites

zachattack83

I appreciate the reply luke, but so far, that is not helping.

When I ls -l the directory, the owner is ms, and the group is ms... I have ms in the emby group, and I have emby in the ms group, just to try to achieve permissions... but it doesn't help.

I am unable to change the owner of the mount to emby, it says the operation is not permitted...

Currently, I can make no changes on the back end, other than adding libraries. I'm attempting to set up the auto organize plug in, but it says it needs permissions to write to the directory...

Link to comment
Share on other sites

zachattack83

It looks like the new folders that are being created, are being done so with out having rwx permissions. This is likely the problem, I am attempting to run a chmod -r a+ugo on all of the emby subfolders, but am getting hit with a lot of operation not permitted results...

Link to comment
Share on other sites

Q-Droid

The emby user and group(s) UID and GID(s) should be the same on your Emby host and OMV for ownership on the NFS shares to be consistent.

You also might have better luck changing ownership and permissions on the NFS export side - OMV.

Whichever UID/GID is creating the files and directories should have the correct umask value to create them with the permissions you want. Default is usually 022 or 0022 and if you want those files and directories created with group write permissions then umask should be 0002 or 002.

 

  • Like 1
Link to comment
Share on other sites

zachattack83

Ok, Thank you for the information! I'll attempt some adjustments and let you know how it goes!

Link to comment
Share on other sites

zachattack83
On 6/10/2021 at 5:09 PM, Q-Droid said:

The emby user and group(s) UID and GID(s) should be the same on your Emby host and OMV for ownership on the NFS shares to be consistent.

You also might have better luck changing ownership and permissions on the NFS export side - OMV.

Whichever UID/GID is creating the files and directories should have the correct umask value to create them with the permissions you want. Default is usually 022 or 0022 and if you want those files and directories created with group write permissions then umask should be 0002 or 002.

 

I got to play around with this today. I'm struggling to find the uid's on the omv system. It does definitely seem like the NFS is causing the issues.  I added rw,user,exec,umask=000 to my mount on fstab, but I think that only works correctly if not on nfs from what examples I'm seeing, they're all on ext4. 

If I do happen to find the OMV IDs, how do I adjust them to match across multiple systems?  Thanks.

Link to comment
Share on other sites

Q-Droid

Editing post:

Ignore the rest of this post below if all you care about is the group write permissions for the emby user. That can be fixed with either umask or ACLs. The stuff below is to make ownership of the files created by emby consistent between the server and OMV,  so that files and directories will be seen as owned by emby on both sides.

 

If you have emby:emby (user:group) on both hosts then life is easier if the UID and GID match across systems. You mentioned giving rwx permissions to emby on OMV? Did this create ACLs on the NFS export path? 
What does ls -l on the NFS path look like on each host?
What about the ms user, is this one also on both hosts?

I don't know what the OMV web control panel allows for user/group management so start with getting the user and group details. You want to find the UID and primary GID for the emby user on the emby server host then find the same on the OMV host. The goal is to change OMV to match the emby server but there's a chance the UID/GID could be in use by another user/group on OMV.

Emby user UID and GID, check on both systems.
$ id emby

Check on OMV host to see if UID and GID are free.
$ getent passwd <emby host UID>
$ getent group <emby host GID>

If one or the other are not free and are different from the emby host then stop. Will have to figure out if the conflict is major or minor and decide how to go forward.
 

Edited by Q-Droid
  • Like 1
Link to comment
Share on other sites

XcOM9876

I had a similar issue with my setup but I was using NTFS shares from windows server, I found the issue was down to how I was mounting the drives in fstab, I had to add a user account when mounting which ironically wasn't the emby user but rather an account on the file share which had read-write permissions and this then translated over to the emby account, I also made emby the owner of the folders which were used as the mount points, have you confirmed if you can replicate the issue with another user account on the server, try creating and deleting a folder or file for example as another user (Without root), once you have tested that you can begin diagnosing the issue in a more methodical way to try and pin point the root of the permissions issue.

Link to comment
Share on other sites

zachattack83

Attached is a screenshot of the ls-l on the emby VM. Another is a screen shot of the same directory on OMV with the users and permissions.

The user ms exists on both machines, as does emby. It also exists on any radarr/sonarr servers that I use for tracking my library.

emby uid on the emby vm is 998.
emby uid on the omv vm is 1003. 

I put up a screen shot of the omv getent commands as well.

Ever since I started messing with this though, my command in the fstab hasn't been connecting on boot.
192.168.1.245:/media /media/ms/storage nfs auto,nofail,noatime,nolock,intr,tcp,actime=1800 0 0

not sure why it suddenly stopped connecting on boot? I have manually mount it each time I restart the machine now.


If I have to rebuild the emby vm, I have no issue with that. I can do it and adjust it so it has similar uid and guid, if that ends up being the easiest way to do it. 
  

emby machine permissions.JPG

omv_user-group_permissions.JPG

omv_id.JPG

Link to comment
Share on other sites

Q-Droid

Making changes on the OMV box looks like a no-go. Those look like core user/group I wouldn't touch. But check the UID of 1003 on the emby VM, it might be a good candidate. It's not absolutely necessary but it does make life easier when you have multiple hosts sharing storage and the file/directory ownership is consistent across machines. If you happen to chown or chgrp something you want predicable results.

If you feel like tackling the change on the emby VM you can modify the emby UID and GID to 1003. Shutdown the emby server first. Then have to chown all the files owned by emby to match the new UID:GID. And would also have to modify users that are group members but not primary.

I see the setgid on /media/ms/storage/emby which should take care of the group ownership for any new files/directories there.

 

  • Like 1
Link to comment
Share on other sites

Q-Droid
7 minutes ago, zachattack83 said:

Also, here are the ACL settings

 

Are those ACLs defined on OMV (is that the OMV GUI)? If so then they WOULD work IF the emby and ms UID/GID were consistent between OMV and your VM. If you make the VM match OMV then the access should be effective immediately.

 

  • Like 1
Link to comment
Share on other sites

zachattack83

Another quick question, do you know how I should mount this network storage in my fstab? like, what would be the preferred line to get the best results for the nfs and uid's in sync?

Link to comment
Share on other sites

zachattack83
Just now, Q-Droid said:

Are those ACLs defined on OMV (is that the OMV GUI)? If so then they WOULD work IF the emby and ms UID/GID were consistent between OMV and your VM. If you make the VM match OMV then the access should be effective immediately.

 

Yep, those are the OMV ACL settings. I literally just set them before I took the screen shot.

I did change the emby uid and group id to 8002 and 9002 on both the omv and the emby vm. It seems to have worked for that part. As you can see in the screen shot, it is identifying the owner and group. Prior to changing the ID and GID on the embyt vm, it actually said "8002" for the user. So, I'm imagining that its getting its information from OMV.

with that being said, if it shows the owner as emby, does that mean that every sub folder created within there from this point forward will always have emby ownership? Like, say MS creates the folder, which is also in the emby group, would it avoid conflict or create it? Sorry for the noob question there lol.

emby_permissions.JPG

Link to comment
Share on other sites

zachattack83
2 minutes ago, zachattack83 said:

with that being said, if it shows the owner as emby, does that mean that every sub folder created within there from this point forward will always have emby ownership? Like, say MS creates the folder, which is also in the emby group, would it avoid conflict or create it? Sorry for the noob question there lol.

I actually just created a folder within the directory temp, and it gave the ownership to MS, so I guess that means that ms will always create directories in there. Is there a way to make it so that anything created within that folder is automatically owned by emby?

Link to comment
Share on other sites

Q-Droid
48 minutes ago, zachattack83 said:

I actually just created a folder within the directory temp, and it gave the ownership to MS, so I guess that means that ms will always create directories in there. Is there a way to make it so that anything created within that folder is automatically owned by emby?

Which user created the folder? The creator will typically be the owner. The ACLs will take care of the access by other users. I don't know if forcing ownership is an option, would have to look into that.

I noticed the recursive option is disabled in your ACL screen shot above. I think that should be enabled to handle subdirectories and files.

  • Like 1
Link to comment
Share on other sites

zachattack83

ms created the folder when I made it using the ubuntu file explorer. I also attempted it from the CLI and got the exact same results.

The recursive aspect only seems to be a one time use thing. You set it, hit apply, it does its thing, and then sets to off when you reopen the window again.

Link to comment
Share on other sites

Q-Droid

What does ls -l look like from one of the media folders? I'd like to see if it did set an ACL and defaults for directories. If it does then new files and directories should inherit the permissions and the ownership should not matter when the ACLs are set recursively. Proper POSIX ACLs are a one time thing if defaults are defined, similar to setgid for the directory.

If the OMV ACL did not setup ACLs on the filesystem you can do that manually from the command line then permissions for emby and ms would be all set going forward.

 

  • Like 1
Link to comment
Share on other sites

zachattack83
12 hours ago, Q-Droid said:

What does ls -l look like from one of the media folders? I'd like to see if it did set an ACL and defaults for directories. If it does then new files and directories should inherit the permissions and the ownership should not matter when the ACLs are set recursively. Proper POSIX ACLs are a one time thing if defaults are defined, similar to setgid for the directory.

If the OMV ACL did not setup ACLs on the filesystem you can do that manually from the command line then permissions for emby and ms would be all set going forward.

 

I think everything might be working just fine now. I set the gid and uid for emby on all machines. I also set the gid for the ms group on all machines. I could not however change the uid of ms as its the primary user and its literally running processes that I can't kill to change it. I also set up the ACL on omv after you had mentioned it, and set it using the permissions seen in the screen shot I posted previously of it. 

I attached the snip of the ls -l on the emby directory. Looks like everything is owned by emby now. 2 attachments, one from the sonarr machine and one from the emby machine (mediaservice)

lsl on emby.JPG

ls on ms.JPG

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...