Closed terrelsa13 closed 4 years ago
@clara-j you were right. It is a permissions issue.
It was deleting the metadata successfully. But not the media. My metadata has a user:group of emby:emby. My media has a user:group of hieroglyph:hieroglyph.
I will have to play around with ACLs to get this working the way I want it to.
@clara-j Question for you: Are the files deleted by the "admin user" or the "track with user"?
The delete command is sent using the API of the Admin user you provided. But to be able to delete the actual files on the filesystem, the linux user that the emby server is running under must have permissions on the folder to delete the files.
You can check what user the emby server is running with the ps command, but if the metadata has user/group emby:emby then it is likely emby. So you will need to make sure that the emby user has delete permissions for that folder. You can either modify the folder so that any users can delete, or add emby to the group and make sure the group is able to delete.
I had a similar, if not the same issue, when I first starting developing this since I was using docker and the media folder I mapped with the RO option and deleting from the filesystem failed due to that. When I updated dockers-compose to no longer mount as RO it worked..
For anyone else who may run into this issue; as @clara-j mentions you will need to add emby to the group that has permissions to delete your media and then make the group permission for that folder rwx. BUT... this will also give any other users in your group rwx permissions allowing them to delete media.
Another option is to specifically give the user emby rwx using an Access Control List.
Easy less secure way
usermod -a -G yourgroupname emby
chmod -R g+rwx /path/to/your/media/folder
Still easy once you learn setfacl and getfacl, but also more secure If you're feeling a little more advanced you can create an ACL to specifically give emby permission to delete media without giving every user added to your group permission to delete media.
setfacl -m u:emby:rwx -R /path/to/your/media/folder
setfacl -d -m u:emby:rwx -R /path/to/your/media/folder
Thanks for the great explanation. Any issue with me adding this to the README for other users that may have the same problem?
No issues with that at all.
Here is the new issue I am opening as requested.
I am not sure if you are talking linux rwx permissions or the "User-->Profile-->Allow Media Deletion From-->All Libraries" setting on the emby server?
Either way, I have tried running the script from my server as the user I am logged in as and as root. Both have rwx permissions to my media files/folders.
When running the script for the first time to set up the config file, I input my username/password for the emby admin account. I then select a different account as the user to track with. Both accounts have their "User-->Profile-->Allow Media Deletion From-->All Libraries" setting checked.
I see the same issue. https://pastebin.com/raw/nsFvPw35