Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error HttpServer: Error processing request; Access to path denied #2

Closed
terrelsa13 opened this issue Oct 29, 2019 · 6 comments
Closed

Comments

@terrelsa13
Copy link
Contributor

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

@terrelsa13
Copy link
Contributor Author

@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.

@terrelsa13
Copy link
Contributor Author

@clara-j Question for you: Are the files deleted by the "admin user" or the "track with user"?

@clara-j
Copy link
Owner

clara-j commented Oct 29, 2019

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..

@terrelsa13
Copy link
Contributor Author

terrelsa13 commented Oct 30, 2019

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.

You only need to do one of the following:

Easy less secure way
#add emby to your group (replace yourgroupname with the name of the group that owns your media folder)

usermod -a -G yourgroupname emby

#change the permissions of your media folder so anyone in your group can delete media

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.

#setup an access control list giving the user emby permission to delete existing media files

setfacl -m u:emby:rwx -R /path/to/your/media/folder

#setup a defualt access contol list giving the user emby permission to delete future media files that will be added

setfacl -d -m u:emby:rwx -R /path/to/your/media/folder

@clara-j
Copy link
Owner

clara-j commented Oct 30, 2019

Thanks for the great explanation. Any issue with me adding this to the README for other users that may have the same problem?

@terrelsa13
Copy link
Contributor Author

No issues with that at all.

clara-j pushed a commit that referenced this issue Oct 18, 2020
All embys/jellyfins may not report the same media item data back. Update to handle missing data items from emby/jellyfin used to build detailed output.
Now if any of the extra data used to build detailed output is missing; fall back to the basic data needed to delete the episode and continue on to the next media item.
Handle KeyError Exception Gracefully.
Add server branding option, choose emby or jellyfin.
Add base url for jellyfin so API calls work when base url is changed.
Update get_days_since_last_watched() to work with emby and jellyfin.
Text clean-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants