Permissions issues on Synology

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
sentience
Posts: 3
Joined: 18 Jun 2020, 03:00

Permissions issues on Synology

Post by sentience » 18 Jun 2020, 03:57

I'm setting up FileBot for the first time on an up-to-date Synology DS1019+, and am having problems that look like folder permissions issues.

A dry run from FileBot Node:
filebot -script 'fn:amc' /volume1/NAS/Downloads/complete/tv --output '/volume1/NAS/iTunes Library' --action TEST -non-strict --order Airdate --conflict auto --lang en --def 'ut_label=TV' 'music=y' 'unsorted=y' 'skipExtract=y' 'emby=localhost:******' 'pushover=******:******' 'excludeList=filebot_amc.excludes' --apply refresh --log all --log-file '/usr/local/filebot-node/data/filebot.log'

------------------------------------------

Run script [fn:amc] at [Thu Jun 18 13:09:46 AEST 2020]
Parameter: ut_label = TV
Parameter: music = y
Parameter: unsorted = y
Parameter: skipExtract = y
Parameter: emby = localhost:******
Parameter: pushover = *****
Parameter: excludeList = filebot_amc.excludes
Argument[0]: /volume1/NAS/Downloads/complete/tv
Use excludes: /volume1/NAS/iTunes Library/filebot_amc.excludes
java.io.IOException: Permission denied
java.io.IOException: Permission denied
at java_io_File$createNewFile$5.call(Unknown Source)
at Script1.run(Script1.groovy:151)
at net.filebot.cli.ScriptShell.evaluate(Unknown Source)
at net.filebot.cli.ScriptShell.runScript(Unknown Source)
at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
at net.filebot.Main.main(Unknown Source)

Error (o_O)

------------------------------------------
Since it looks like FileBot doesn't have permission to create the excludes file, I shelled into the NAS and created it with touch filebot_amc.excludes.

After that, the dry run seems to run successfully, though of course it is not actually writing any files to the output directory (because it's a dry run), so the permissions issue is not apparent:
filebot -script 'fn:amc' /volume1/NAS/Downloads/complete/tv --output '/volume1/NAS/iTunes Library' --action TEST -non-strict --order Airdate --conflict auto --lang en --def 'ut_label=TV' 'music=y' 'unsorted=y' 'skipExtract=y' 'emby=localhost:******' 'pushover=******:******' 'excludeList=filebot_amc.excludes' --apply refresh --log all --log-file '/usr/local/filebot-node/data/filebot.log'

------------------------------------------

Run script [fn:amc] at [Thu Jun 18 13:14:40 AEST 2020]
Parameter: ut_label = TV
Parameter: music = y
Parameter: unsorted = y
Parameter: skipExtract = y
Parameter: emby = localhost:******
Parameter: pushover = *****
Parameter: excludeList = filebot_amc.excludes
Argument[0]: /volume1/NAS/Downloads/complete/tv
Use excludes: /volume1/NAS/iTunes Library/filebot_amc.excludes (1)
Ignore hidden: /volume1/NAS/Downloads/complete/tv/.DS_Store
Ignore system path: /volume1/NAS/Downloads/complete/tv/@eaDir
Input: /volume1/NAS/Downloads/complete/tv/******/******.mkv
Input: /volume1/NAS/Downloads/complete/tv/******/******.mkv
Process as TV Series [TV]
Group: {Series=true} => [******.mkv, ******.mkv]
Rename episodes using [TheTVDB] with [Airdate Order]
Auto-detected query: [******]
Fetching episode data for [******]
Auto-detected query: [******]
Fetching episode data for [******]
[TEST] from [/volume1/NAS/Downloads/complete/tv/******/******.mkv] to [/volume1/NAS/iTunes Library/TV Shows/******/Season 07/******.mkv]
[TEST] from [/volume1/NAS/Downloads/complete/tv/******/******.mkv] to [/volume1/NAS/iTunes Library/TV Shows/******/Season 05/******.mkv]
Processed 2 files
Done ヾ(@⌒ー⌒@)ノ
When I execute the task, though, I am once again unable to write the excludes file:
filebot -script 'fn:amc' /volume1/NAS/Downloads/complete/tv --output '/volume1/NAS/iTunes Library' --action duplicate -non-strict --order Airdate --conflict auto --lang en --def 'ut_label=TV' 'music=y' 'unsorted=y' 'skipExtract=y' 'emby=localhost:******' 'pushover=******:******' 'excludeList=filebot_amc.excludes' --apply refresh --log all --log-file '/usr/local/filebot-node/data/filebot.log'

------------------------------------------

Run script [fn:amc] at [Thu Jun 18 13:33:06 AEST 2020]
Parameter: ut_label = TV
Parameter: music = y
Parameter: unsorted = y
Parameter: skipExtract = y
Parameter: emby = localhost:******
Parameter: pushover = *****
Parameter: excludeList = filebot_amc.excludes
Argument[0]: /volume1/NAS/Downloads/complete/tv
Use excludes: /volume1/NAS/iTunes Library/filebot_amc.excludes (1)
Ignore hidden: /volume1/NAS/Downloads/complete/tv/.DS_Store
Ignore system path: /volume1/NAS/Downloads/complete/tv/@eaDir
Failed to write excludes: /volume1/NAS/iTunes Library/filebot_amc.excludes: java.nio.file.AccessDeniedException: /volume1/NAS/iTunes Library/filebot_amc.excludes
Abort (×_×)

------------------------------------------

[Process error]

🔺 Exit Code: 4
Assuming the filebot process is running as the admin user on my Synology, it should have write access to the entire /volume1/NAS directory tree. Using the Synology File Station's Permission Inspector, I can see that the admin user does indeed have full Administration, Read, and Write permissions to the filebot_amc.excludes file, but checking via the shell tells a different story:
[email protected]:/volume1/NAS/iTunes Library$ ls -l filebot_amc.excludes
-rw-r--r-- 1 sentience users 0 Jun 18 13:12 filebot_amc.excludes
I used chmod 664 to make it writable by the users group, but that did not change the behaviour.

I used chmod 666 and that allowed the process to progress, but ran into a similar permissions issue actually hard-linking the files into the destination directory.
filebot -script 'fn:amc' /volume1/NAS/Downloads/complete/tv --output '/volume1/NAS/iTunes Library' --action duplicate -non-strict --order Airdate --conflict auto --lang en --def 'ut_label=TV' 'music=y' 'unsorted=y' 'skipExtract=y' 'emby=localhost:******' 'pushover=******:******' 'excludeList=filebot_amc.excludes' --apply refresh --log all --log-file '/usr/local/filebot-node/data/filebot.log'

------------------------------------------

Run script [fn:amc] at [Thu Jun 18 13:45:34 AEST 2020]
Parameter: ut_label = TV
Parameter: music = y
Parameter: unsorted = y
Parameter: skipExtract = y
Parameter: emby = localhost:******
Parameter: pushover = *****
Parameter: excludeList = filebot_amc.excludes
Argument[0]: /volume1/NAS/Downloads/complete/tv
Use excludes: /volume1/NAS/iTunes Library/filebot_amc.excludes (1)
Ignore hidden: /volume1/NAS/Downloads/complete/tv/.DS_Store
Ignore system path: /volume1/NAS/Downloads/complete/tv/@eaDir
Input: /volume1/NAS/Downloads/complete/tv/******/******.mkv
Input: /volume1/NAS/Downloads/complete/tv/******/******.mkv
Process as TV Series [TV]
Group: {Series=true} => [******.mkv, ******.mkv]
Rename episodes using [TheTVDB] with [Airdate Order]
Auto-detected query: [******]
Fetching episode data for [******]
Auto-detected query: [******]
Fetching episode data for [******]
[DUPLICATE] from [/volume1/NAS/Downloads/complete/tv/******/******.mkv] to [/volume1/NAS/iTunes Library/TV Shows/******/Season 07/******.mkv]
cp: cannot create regular file ‘/volume1/NAS/iTunes Library/TV Shows/******/Season 07/******.mkv’: Permission denied
[DUPLICATE] Failure: java.nio.file.AccessDeniedException: /volume1/NAS/iTunes Library/TV Shows/******/Season 07/******.mkv
Processed 0 files
AccessDeniedException: /volume1/NAS/iTunes Library/TV Shows/******/Season 07/******.mkv
Processing 2 unsorted files
[DUPLICATE] from [/volume1/NAS/Downloads/complete/tv/******/******.mkv] to [/volume1/NAS/iTunes Library/Unsorted/******/******.mkv]
[DUPLICATE] from [/volume1/NAS/Downloads/complete/tv/******/******.mkv] to [/volume1/NAS/iTunes Library/Unsorted/******/******.mkv]
Processed 2 files
Notify Emby: [host:localhost, token:******]
POST: http://localhost:8096/Library/Refresh?api_key=******
Sending Pushover notification
Done ヾ(@⌒ー⌒@)ノ

------------------------------------------

[Process completed]
Strangely, the failure to write the first file to the output directory seems to have caused FileBot to fall back to treating both files as “unsorted”, and FileBot successfully created a new Unsorted subdirectory and wrote the files there.

I see that the newly-written files are owned by admin:administrators; however, the admin user is definitely in both the administrators and users groups, so I would have expected it to be able to write to a 775 directory owned by sentience:users.

What is the recommended setup for enabling FileBot to write to my output directory without making all of the files/directories world-writable (666/777)?

User avatar
rednoah
The Source
Posts: 18539
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Permissions issues on Synology

Post by rednoah » 18 Jun 2020, 04:57

:idea: Since Synology uses ACLs, classic Unix permissions are largely irrelevant since ACLs overrule them:
https://www.synology.com/en-us/knowledg ... nology_NAS


The easiest way to figure out permission problems is not even try, and to just create a new share with pristine permissions instead. That that must work out of the box, and if it stops working later on after you change something, then you'll have a general idea as to what the culprit might be.
:idea: Please read the FAQ and How to Request Help.

sentience
Posts: 3
Joined: 18 Jun 2020, 03:00

Re: Permissions issues on Synology

Post by sentience » 30 Jun 2020, 23:35

Thank you! I resolved this by ignoring the Unix permissions as you suggested and using the "Apply to this folder, sub-folders and files" checkbox in the Synology File Station UI to replace the customized permissions I had applied to my media library with the default permissions that existed at the root directory of my shared folder.

Post Reply