Read/Write access denied with mounted drives?

Hi everyone,

New to the forums, hope you are all well!

I need some helps please…

Im running DietPi on a Raspberry Pi 3 B+. Running the latest image of DietPi (v6.14).
I have Sonarr, Transmission and Jackett installed. This is all connected to my network (obviously) and I have mounted a shared from a Western Digital MyCloud. This share has my Movies/Series folder and a Transmission folder.

This was all working perfectly until just the other day. What usually happens when the episode has finished downloading is the episode is moved from the Transmission folder to the Series folder (These are both on the same Share).

I can quite work out when it stopped working, but now I get this error:

Couldn't import episode /mnt/samba/transmission/sonarr/[insert name here].mkv: Access to the path is denied.

I have posted on the Sonarr Forums and what I can gather is that Sonarr doesn’t have permission to write/copy/move the downloaded file to the destination. As seen here by one of the replies:

Given

System.UnauthorizedAccessException: Access to the path “/mnt/samba/Series/[series name]/[tvshow.nfo” is denied.

>
> I’d say the issue is writing to the destination.

Now I'm wondering what has changed??? Like I say, this was working perfectly a few days/weeks ago. Has one of the latest DietPi updates changed permissions somewhere??

Please can someone help?

Thanks in advance everyone..

make sure permissions are set correctly

cd into that directory, then do a ls -lah and make sure the directories owners and groups are the same…the might have changed

If the did, then do a

# chown -R user:group /directory

or course user:group should match the rest

Hi WarHawk,

Thanks so much for taking the time to reply and explain.

Im not that great in the terminal. I was looking how to do this the other day, couldn’t work it out. So thanks for explaining.

Unfortunately that doesn’t seem to have worked… See screen shot below:
Screen Shot 2018-09-05 at 19.20.16.png
Did I do the chown command correctly??
I noticed it has root permissions, that sounded correct to me?

I then tied a manual import of the episodes and I still have the same issue:

Anymore advice please WarHawk??

Thanks again.

After playing around some more with this issue, I can see the permissions is the problem. However I cannot change them. I even installed Webmin and tried to use that to change the permissions (as my terminal work isnt great at all). I could still not change the permissions/owner in Webmin.

Something must have changed in the coding in one of the latest DietPi image updates???

I eventually got so frustrated with it that I formatted the SD and did a clean install of Sonarr, Transmission, Jacket and Webmin. Tried changing permissions/owners again in terminal, no joy. Tried again on Webmin, no joy. It seems its resisting the change…

I configured Sonarr with Jackett and Transmission, went to add my Series and got this error:


Now I can see the permissions is the problem here, BUT my real problem is I have no idea how to change this…

Please can someone help me with this??

change from root:root to sonarr:sonarr

To change permissions
chmod 777 (for read/write/execute) then folder

good explanation of chmod
https://ubuntuforums.org/showthread.php?t=1252905

Hi WarHawk

Thanks again for taking the time to help.

I tried exactly what you said. Screenshot below shows the commands and then a “ls -lha /directory” so see if anything changed. Unfortunately, nothin did…?


It almost seems that I dont have the permissions to even attempt a permission or user:owner change…

Im really stuck here… Did something change in one of the recent DietPi updates possibly???

Someone on the DEV team will have to answer that…all I know as sudo or root with the # you have the ability to do anything…so the

chown -R sonarr:sonarr /mount/samba/Series

should work

Hi,

same problem as in my thread.

chown -R sonarr:sonarr /mount/xxx

doesn’t work.

Yip, It is almost like the DietPi software is refusing to change the user/owner or the permissions. I have done it via terminal, via the DietPi explorer in “dietpi-launcher” and also in Webmin. They just cannot be changed.

I sat up the other night with a very experienced software developer and they were boggled by it too…


So please can this be escalated??? It seems the latest DietPi image, v6.14, is not working as it should??

Hi WarHawk,

Just giving you a heads up, as I say in my previous post, this doesn’t work… I have no idea whats going on?

I’m at a loss…hopefully someone from the DEV team can assist

Thanks for the help though WarHawk

Anyone from the DEV team monitoring the thread???

finch_6
Sorry for the late attention. I opened an issue about it on Github to force a solution in v6.15 release, or at least to find a workaround for your case to apply: https://github.com/Fourdee/DietPi/issues/2067

I never really used network drives, so can just guess what could be a reason that your chown/chmod attempts failed:

  • Can you check if the file system of the Samba server actually supports permissions? E.g. usual Windows file systems NTFS and FAT do not support the POSIX permissions that you apply on Linux systems via chown/chmod. An NTFS drive directly attached to a Linux system at least does not support it. I am now not sure, how this is handled in case of network drives, but it makes sense that it is the same there.
  • A thinkable solution, that goes hand in hand with the case, that ls -al actually shows root:root and 755 permissions, is that somehow by the mount driver just Samba client side, permissions are applied. Possibly one can change those permissions via some Samba/mount settings. In this case we would need to change the permissions client-side to dietpi:dietpi 775 (or 770), which would allow read/write access for Sonarr and other software.

About what changed with v6.12:

  • For security and consistency reasons we switched several software titles to run not as root user any more, but as an own user. E.g. Sonarr now runs as user sonarr, with limited access to the /mnt/dietpi_userdata directory and it’s own install, config and data directories of course.
  • We solved cross access (Media players => downloader directories, downloaders => network share (Server!) dirs and such) via dietpi user group. Sonarr runs as dietpi group (sonarr:dietpi) which allows read/write access to shares, download and media dirs etc.
  • But to be true, we did not yet think about network mounts, just about cases where the DietPi system is network share server :roll_eyes:. And if permissions cannot be applied, this is a further difficulty, as above.

Hi,

I don’t believe Samba supports setting file/folder permissions, as the permissions used are set during the mount, as defined by the server:
https://github.com/Fourdee/DietPi/issues/2067#issuecomment-420568750

i"m having the exact same issue with a mounted Samba share, from the terminal i can create folders etc. but none of the services i installed (sonarr, radarr, sabnzbdplus) are able to create files on the /mnt/share i tried to play with some setting withing the /etc/fstab file but so far no luck , is there a way to change the users these services are running on?

Updated to v6.15 yesterday and still no joy with this…?

Still getting the same error…


MichaIng, Im busy working on answers to your questions :rofl: :rofl:
Im not a boffin with this stuff, just know enough to get by…

Seems this all started when the permissions where changed from root to sonarr… wish it was just as easy as changing back…

:thinking: :thinking: :thinking:

MichaIng, Fourdee,

Since this wasn’t resolved in v6.15, is there any way to “roll back” to a version of DietPi that didn’t have this issue??
At least until it is resolved???

Im all for having the latest version of any software (even test builds), but this is one I’d rather go back to an older version until its fixed…

Hi,

Unfortunately, it is not possible to roll back to a previous DietPi version, unless you have a DietPi-Backup of the system, which can be used to restore.

I’ll run some local testing in regards to trying to find a solution for samba as userdata folder, with non-root account access.
https://github.com/Fourdee/DietPi/issues/2067#issuecomment-421752937

Failing the above, i’ll give you information in regards to setting the run-level user for those applications to root (which will make some “security” aware users cry :slight_smile:)

Hi Fourdee,

Thanks for the reply. I look forward to any solution possible, thank you!!

finch_6 Fourdee
I found a solution :sunglasses::

sed -i 's/,iocharset=utf8,vers=/,iocharset=utf8,uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770,vers=/g' /etc/fstab
umount /mnt/samba
mount -a
ls -al /mnt/samba

NB: Replace /mnt/samba with the actual mount location.
The above sets user (uid) and group (gid), as well as global file and directory permissions for the whole samba share.
dietpi:dietpi 770 should allow r/w access for Sonarr and such, as these software titles run as their own user, but as dietpi group.
umount and remount is needed to apply the changes, then check via ls -al.
Somehow external guides mention that as well Samba server side there need to be changes done, but it worked here to create a totally new user, set it as uid+gid, remount and access + create files with this user within the mount.

Fourdee
I think we should set this as default for samba mounts, to allow access for our download and media software?
I am going to find out how to achieve the same for nfs mounts.