Skip to content

Permission denied if not owner #2580

Description

@AnonymousX86

Describe the bug
Bazarr can't save files if user is not owner of desired directory or directory is not protected (chmod o=rwx).

To Reproduce

  1. Create user bazarr with group.
  2. Create user radarr with group.
  3. Add user bazarr to group radarr.
  4. Change /movies directory ownership to radarr:radarr.
  5. Apply permissions lesser than o=rwx, e.g. 0775.
  6. Run Bazarr with PUID and PGID of bazarr.
  7. Bazarr can't save subtitles due to "Errno 13: permission denied".

Expected behavior
Bazarr should save subtitles, as it has sufficient permission to directory (g=rwx).

Screenshots
Shell output and logs below.

Software

  • Bazarr: 1.4.3 (from Linuxserver.io)
  • Radarr version: 5.6.0.8846 (from Linuxserver.io)
  • Sonarr version: 4.0.5.1710 (from Linuxserver.io)
  • OS: Ubuntu 22.04 LTS
  • Docker version: 27.0.3

Additional context
Example:

$ cd /movies
$ ls -l | grep Dune
drwxrwxr-x 2 radarr radarr 4096 Jun  1 01:29 Dune
$ ls -l Dune
total 2539684
-rwxrwxr-x 1 radarr radarr 2599600403 Jun  1 01:28 'Dune.mp4'
-rwxrwxr-x 1 radarr radarr     175894 May 26 12:09  fanart.jpg
-rwxrwxr-x 1 radarr radarr       8626 Jul 12 12:21  movie.nfo
-rwxrwxr-x 1 radarr radarr     837275 May 26 12:09  poster.jpg
$ groups bazarr
bazarr : bazarr sonarr radarr

Docker logs:

15 23:34:16,679 - root                             (7fd7b968bb38) :  ERROR (download:99) - BAZARR Error saving Subtitles file to disk for this file /movies/Dune/Dune.mp4: PermissionError(13, 'Permission denied')

Issue does not occur when applying o=rwx permissions. Subtitles are being saved with bazarr:bazarr ownership with 644 permissions.

$ ls -la
drwxrwxrwx 1 sonarr sonarr     12288 Jul 15 21:55 .
-rw-r--r-- 1 bazarr bazarr     22448 Jul 15 21:55 Dune.srt

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions