[SOLVED] Permission Denied when Emby Server accessing sharedfolders

    • Resolved
    • OMV 4.x

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Permission Denied when Emby Server accessing sharedfolders

      Recently installed Ember Server (as a Debian package from their web-site).
      All has been fine until today.

      None of the devices (Emby Apps) can play any videos on the servers.

      Checking the Emby Server logs shows that Permission was denied when the Emby server tries to access the file on the sharedfolder.
      I checked the folder/files ACL on OMV and they are set correctly (for emby user and group).

      I reported the issue at Emby forums here and Luke at Emby suggested seeking OMV help so here I am.

      Essential when the Emby App (on the TV) requests the server to play the movie, the server complains with "Permission denied" on the file in question:

      Source Code

      1. 2019-03-18 19:14:19.811 Error HttpServer: Error processing request
      2. *** Error Report ***
      3. Version:
      4. Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
      5. Operating system: Unix
      6. 64-Bit OS: True
      7. 64-Bit Process: True
      8. User Interactive: True
      9. Processor count: 2
      10. Program data path: /var/lib/emby
      11. Application directory: /opt/emby-server/system
      12. System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/sharedfolders/d1/movies/12 Years A Slave (2013)/12 Years A Slave (2013).srt' is denied. ---> System.IO.IOException: Permission denied
      13. --- End of inner exception stack trace ---
      14. at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
      15. at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
      Display All

      I checked the ACL using 'getfacl' command it shows:

      Source Code

      1. root@OMV:/sharedfolders/d1/movies/12 Years A Slave (2013)# getfacl *.mkv
      2. # file: 12 Years A Slave (2013).mkv
      3. # owner: admin
      4. # group: users
      5. user::rwx
      6. user:root:rwx
      7. user:daemon:rwx
      8. user:systemd-timesync:rwx
      9. user:ntp:rwx
      10. user:statd:rwx
      11. user:avahi:r-x
      12. user:sshd:r-x
      13. user:emby:rwx
      14. user:admin:rwx
      15. user:openmediavault-webgui:rwx
      16. user:macnb:rwx
      17. user:nobody:rwx
      18. group::rwx
      19. group:root:rwx
      20. group:daemon:rwx
      21. group:adm:rwx
      22. group:audio:rwx
      23. group:video:rwx
      24. group:users:rwx
      25. group:systemd-journal:rwx
      26. group:systemd-timesync:rwx
      27. group:crontab:rwx
      28. group:ntp:rwx
      29. group:ssh:r-x
      30. group:emby:rwx
      31. group:openmediavault-config:rwx
      32. group:nogroup:rwx
      33. mask::rwx
      34. other::r-x
      Display All

      All the media are in /sharedfolders and Ember library was setup to point to them. All was fine and working great until today.
      Not sure what I changed to get to this situation. Now nothing plays.

      Any way to debug this further ?
      HP Microserver N40L; OMV 4.1.18-2;

      The post was edited 1 time, last by macnb ().

    • Problem solved.

      I finally fixed it. It was a permission issue and so simple (and obvious now).

      Some how, the ownership of /sharedfolder got changed to macnb:users (which has UID's 1000:100).
      I put it back to admin:users (which has UID's 998:100) and immediately fixed the problem Emby server was having.

      Must have been something to do with me setting up Nextcloud and/or Filerun docker images giving them access to a folder within /sharedfolder (it may have changed the ownership).

      BTW, Filerun docker is particularly bad as it changes the HOST Volume folder ownership explicitly. It is allowed to do it by the mere fact that docker runs the image with elevated authorised permission (i.e.root). Filerun logs shows:

      Source Code

      1. + chown -R www-data:users /var/www/html
      2. + chown www-data:users /user-files
      During my experimentations, I may have accidentally mapped the Host folder /sharedfolders to container folder /user-file.
      Oouch !

      But...that does not explain how the ownership got changed to macnb:users.
      Beware folks.
      HP Microserver N40L; OMV 4.1.18-2;
    • Users Online 1

      1 Guest