Permissions issue only w/ changing date/time radarr w/ SMB share on Synology NAS

Creating a bug report/issue

Required Information

  • DietPi version:
    G_DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=10
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
  • Distro version: bullseye
  • Kernel version:
    Linux DietPi2 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux
  • SBC model: Virtual Machine (x86_64) (VM running on ESXi 7.0U3)
  • Power supply used: N/A (VM)
  • SD card used: N/A (VM)

Additional Information (if applicable)

  • Software title: Radarr
  • Was the software title installed freshly or updated/migrated? Installed freshly
  • Can this issue be replicated on a fresh installation of DietPi? Yes, it is happening on 3 different installations

Steps to reproduce

  1. Use Drive Manager to connect to SMB share on Synology NAS using user account with full access to said shared folder (mapping to /mnt/media)
  2. Setup Radarr to use /mnt/media/movies as root directory
  3. Configure Radarr to set modified date of file to date of Cinema Release
  4. Import movie
  5. Check Radarr Events and see error:
    Unable to set date of file [/mnt/media//.mp4]: Access to the path ‘/mnt/media//.mp4’ is denied.

Expected behaviour

  • .mp4 file should have modified date set to the date of the Cinema Release for the movie

Actual behaviour

  • Movie imports correctly, extra files created (.nfo, fanart, poster)
  • Radarr reports error when trying to change the date/time of the file.

Extra details

  • I was able to find a few more details. I ssh’d into the dietpi and tried to ‘touch’ the file while running as the radarr user (su - radarr). I received this error:
    touch: setting times of ‘.mp4’: Operation not permitted
  • All the files under /mnt/media are owned by dietpi (user and group) so I tried running touch as the dietpi user and was successful.
  • I tried adding the radarr user to the dietpi group and there was no change (still get the same errors)
  • Prior to setting up the DietPi, I was running Radarr in a docker container on my Synology and did not run into this issue so I’m pretty sure it’s a problem with DietPi, not my share or my NAS.
  • I manage this same setup in 3 different places and all 3 are showing the same problem.

Can somebody help me? Based on the errors I’m seeing using the touch command, it seems to be a problem with the radarr user not having enough permissions. It can create folders and move files and create files, but can’t change the date/time. While I’m familiar with Linux, this is a bit over my head so I’m not sure what to change to fix this. If the permissions can’t be fixed, can I setup radarr to run as the dietpi user? I’m aware that running each application as a separate user is a better security practice, but for something like this, I’d rather have the functionality. I tried going into the service settings for radarr and uncommenting the setting that defined the user, but then when I restarted radarr, the web interface never came back up. When I put the setting back and restarted the service, all was working again. I don’t know enough about how DietPi works to troubleshoot this further.

ETA: I just ran across a posting on StackExchange with the following information:
When setting file timestamps to the current time, touch can change the timestamps for files that the user does not own but has write permission for. Otherwise, the user must own the files. Some older systems have a further restriction: the user must own the files unless both the access and modification times are being set to the current time.
I just confirmed that when I run ‘touch’ against a file, it updates the times to the current time and I can do this as the radarr user. However, when I run ‘touch -m’ to only update the modified time, I get the same error as before.

So, with this in mind, what is the best way to fix this for me.

Any help would be appreciated. Thanks.

A Samba share might not be the best choice for this scenario as Samba don’t support Linux file system permissions at all. In case of DietPi we mount a CIFS share as user/group dietpi with permission 770. Means whatever you store on the CIFS share, it will be owned by user/group dietpi with permission 770. Trying to change files like Radarr is doing will have 0 effect.

If the share is used by Radarr only, you could adjust the user who is mounting the share. Have a look to /etc/fstab. There you see following on the CIFS share definition uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770. You could try to adjust it on your need. Means change user or as another option, adjust the mode to 777.

Probably bettwer would be to use a NFS share provided by your Synology.