Sabnzbd permission error writing to external hard drive

I have an external hard drive monuted to my Pie. I get this when sabnzbd tries to copy the downloaded file:

Cannot change permissions of /mnt/Pie/TV/_UNPACK_TV.Show.(2020).S02E02.(1080p.HMAX.WEB-DL.x265.HEVC.10bit.DD.5.1.Vyndros)-xpost/TV.Show.S02E02.Seven.1080p.10bit.HMAX.WEB-DL.DD5.1.HEVC-Vyndros.mkv
Cannot change permissions of /mnt/Pie/TV/_UNPACK_TV.Show.(2020).S02E02.(1080p.HMAX.WEB-DL.x265.HEVC.10bit.DD.5.1.Vyndros)-xpost
Failed moving /mnt/dietpi_userdata/downloads/incomplete/TV.Show.(2020).S02E02.(1080p.HMAX.WEB-DL.x265.HEVC.10bit.DD.5.1.Vyndros)-xpost/[N3wZ] \mO40cM120152\::[PRiVATE]-[WtFnZb]-[newz[NZB].nfo]-[2+2] - "" yEnc  13 (1+1) to /mnt/Pie/TV/_UNPACK_TV.Show.(2020).S02E02.(1080p.HMAX.WEB-DL.x265.HEVC.10bit.DD.5.1.Vyndros)-xpost/[N3wZ] \mO40cM120152\::[PRiVATE]-[WtFnZb]-[newz[NZB].nfo]-[2+2] - "" yEnc  13 (1+1)
Cannot change permissions of /mnt/Pie/TV/TV.Show.(2020).S02E02.(1080p.HMAX.WEB-DL.x265.HEVC.10bit.DD.5.1.Vyndros)-xpost

Its just a default install of sabnzbd and I haven’t tried to change any folders. I figure I must have done something to the permissions on the disk but I’m not sure what I need to do to resolve this?

Sabnzbd service runs as the user sabnzbd

root@DietPi:~# groups sabnzbd
sabnzbd : dietpi

When i run:

sudo -u sabnzbd touch /mnt/Pie/TV/test.file

The file is created.

TIA

Issue is not with creating files. It’s more the problem to change permissions on an existing file. Can you share following

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
root@DietPi:~# lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
NAME FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda               931.5G  0 disk                                                
└─sda1
     exfat  Pie   931.5G  0 part /mnt/Pie   29015e5e-01                          40B1-1CA3
mmcblk0
│                  29.7G  0 disk                                                
├─mmcblk0p1
│    vfat           128M  0 part /boot      dbcc801d-01                          22BC-C457
└─mmcblk0p2
     ext4          29.6G  0 part /          dbcc801d-02                          bcad65fb-9213-4e6a-9d71-294698c5aad1

Well your disk is using an exfat file system format. This did not support Linux file system permissions at all. Hence you are not able to change permissions. Means your error message are expected. You would need to format your drive with a file system format like ext4

OK. Formatted the disk as ext4 and mounted with Dietpi-Drive_manager

root@DietPi:/mnt# lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
NAME FSTYPE LABEL   SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda               931.5G  0 disk                                                
└─sda1
     ext4         931.5G  0 part /mnt/pie   29015e5e-01                          17a135af-736a-4225-a6d8-cc7936b66dfe
mmcblk0
│                  29.7G  0 disk                                                
├─mmcblk0p1
│    vfat           128M  0 part /boot      dbcc801d-01                          22BC-C457
└─mmcblk0p2
     ext4          29.6G  0 part /          dbcc801d-02                          bcad65fb-9213-4e6a-9d71-294698c5aad1

When I now try the touch command I get permission denied:

root@DietPi:/mnt# sudo -u sabnzbd touch /mnt/pie/TV/test.file
touch: cannot touch '/mnt/pie/TV/test.file': Permission denied

Im also having issues setting a root path in Sonarr as well:

|Warn|SonarrErrorPipeline|Invalid request Validation failed: 
 -- Path: Folder is not writable by user sonarr

How do I set the permissions so that these accounts can write to the disk?

You would need to grant permission to the users who should write to the folder. Can you share following

ls -la /mnt/pie/TV/
root@DietPi:/mnt# ls -la /mnt/pie/TV/
total 216
drwxr-xr-x 29 root root 12288 Feb 27 16:29  .
drwxr-xr-x  5 root root  4096 Feb 27 16:24  ..
drwxrwxr-x  3 root root  4096 Feb 23 10:53 'American Rust'
drwxrwxr-x  3 root root  4096 Feb 23 13:38 'And Just Like That'
drwxrwxr-x  6 root root  4096 Feb 23 14:02 'Black Mirror'
drwxrwxr-x  3 root root  4096 Feb 23 14:10  Chernobyl
drwxrwxr-x  3 root root 12288 Feb 23 15:08  Fargo
drwxrwxr-x  3 root root  4096 Feb 23 16:06 'Godfather of Harlem'
drwxrwxr-x  4 root root  4096 Feb 23 16:44 "Grey's Anatomy"
drwxrwxr-x  3 root root  4096 Feb 23 16:52 'Line of Duty'
drwxrwxr-x  2 root root  4096 Feb 23 17:42 'Making a Murderer'
drwxrwxr-x  3 root root  4096 Feb 23 17:42 'Match of the Day'
drwxrwxr-x  3 root root  4096 Feb 23 17:42 'Match of the Day 2'
drwxrwxr-x  4 root root  4096 Feb 23 18:08  MINDHUNTER
drwxrwxr-x  3 root root  4096 Feb 25 10:24 'On Becoming a God in Central Florida'
drwxrwxr-x  4 root root  4096 Feb 25 11:41 'Raised by Wolves (2020)'
drwxrwxr-x  2 root root  4096 Feb 25 11:41 'Take Us Home - Leeds United'
drwxrwxr-x  4 root root  4096 Feb 25 12:21 'Take Us Home- Leeds United'
drwxrwxr-x  4 root root  4096 Feb 25 12:41 'Ted Lasso'
drwxrwxr-x  3 root root  4096 Feb 25 13:34 'The Act'
drwxrwxr-x  5 root root  4096 Feb 25 15:04 "The Handmaid's Tale"
drwxrwxr-x  2 root root 24576 Feb 25 15:28 'The Leftovers'
drwxrwxr-x  4 root root  4096 Feb 25 16:18 'The Mandalorian'
drwxrwxr-x  3 root root  4096 Feb 25 16:45 'The Stand (2020)'
drwxrwxr-x  4 root root  4096 Feb 25 17:55 'The Twilight Zone (2019)'
drwxrwxr-x  2 root root 69632 Feb 26 14:36 'The Wire'
drwxrwxr-x  3 root root  4096 Feb 26 15:11 'True Detective'
drwxrwxr-x  4 root root  4096 Feb 27 11:58  Westworld
drwxrwxr-x  3 root root  4096 Feb 27 13:00 'Who Is America!'

as you can see, all folder are owned by user/group root. Means, root is the only one who could write into this folder.

Let’s try to change this

chown -R sabnzbd:dietpi /mnt/Pie/TV
chmod 775 /mnt/Pie/TV

This should change permission for all folder/files inside /mnt/Pie/TV to user sabnzbd and group dietpi. As well we go to allow write permission for group dietpi, to allow various apps like Sonarr to access them.