I’ve got transmission installed and it works great. I’ve changed settings.json to run a sh script to extract completed torrents (/opt/Scripts/extract.sh). I’ve chmod everything so the permissions should work, but when it comes time to do the actual extract I’m getting a Permission denied error. Journalctl:
Nov 19 10:06:14 osmc transmission-daemon[778]: No files to extract
Nov 19 10:06:14 osmc transmission-daemon[778]: Cannot create FileOfDubiousIntent.nfo
Nov 19 10:06:14 osmc transmission-daemon[778]: Permission denied
Transmission is running as OSMC (ps auxf), and clearly transmission has write access to the folder or it couldn’t store the file. its running an unrar command:
find /$TR_TORRENT_DIR/$TR_TORRENT_NAME -name "*.rar" -execdir unrar e -o- "{}" \;
Based on the errors I’m thinking I messed up a permission somewhere along the way, but I’m having trouble figuring out where the problem might be. Any thoughts?
What’s the starting point of your find command? It should be a directory but I see /$TR_TORRENT_DIR/$TR_TORRENT_NAME Is $TORRENT_NAME always a directory?
Please show the ownership/permissions of the shell script, plus ownership/permissions of the torrent directory, and those of a rar file.
You could also add the command touch zzz command to your shell script to see if it creates the file zzz, as well as the creation userid.
I see where you’re coming from, but I think I’m passed that stage already. JournalCTL:
Nov 19 10:06:14 osmc transmission-daemon[778]: Cannot create file.nfo
Nov 19 10:06:14 osmc transmission-daemon[778]: Permission denied
Nov 19 10:06:14 osmc transmission-daemon[778]: Cannot create file.exe
Nov 19 10:06:14 osmc transmission-daemon[778]: Permission denied
In this case file.nfo and file.exe are files that are in the RAR archive. So its getting far enough that its executing the unrar command against the correct file, it just can’t extract it due to a permission problem.
The script wouldn’t run without transmission due to the environmental variables the script uses. However, if I run
find File -name "*.rar" -execdir unrar e -o- "{}" \;
it works perfectly and gives no errors. only when Transmission executes the script does it have a permission problem.
Everything I know about linux I’ve learned from OSMC, so I’m still in diapers. Is there a permission gap that occurs between transmission executing the script, and passing that permission on to unrar as the script executes?
I’ve not got transmission installed on my osmc boxes, it would interesting to see what user is transmission is running with, please post the output of:
That’s what we need to determine. Generally speaking, a program or script will run under the user that called it. The debug shell script might shed some light on what’s happening.
Just to clarify one point: was transmission installed from the OSMC app store?
@dillthedog Yes, I installed it from the AppStore. @Tom_Doyle which is why I get the following:
osmc@osmc:/opt/Scripts$ cat /lib/systemd/system/transmission-daemon.service
cat: /lib/systemd/system/transmission-daemon.service: No such file or directory
Modified to cat /lib/systemd/system/transmission.service
Thank you for all the help, I know its not exactly what this board is for but sometimes its difficult to narrow down exactly where you should be asking the questions.
I’m going to explore the variables used by Transmission, but for the time being I solved the problem by just putting a
cd /$TR_TORRENT_DIR/$TR_TORRENT_NAME/
at the start of my shell script. This changes the directory within the script itself so its no longer executing at the root level. Seems to be working for the time being, despite feeling a bit kludgy.