Writing a file: permission denied

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
SeeDoubleYou
Posts: 2
Joined: 17 Mar 2012, 17:53

Writing a file: permission denied

Post by SeeDoubleYou » 17 Mar 2012, 18:02

I want filebot to run each time qBittorent is done with a new file. qBittorent offers a feature for this. I call a groovyscript with filebot. When I do this from commandline it works perfectly, but not from qBittorent. So To do some testing I wanted to check whether the script runs by writing the arguments it gets to a file. Still with me? Ok then. To do this I added the following to my script:

Code: Select all

File file = new File("/home/myusername/funbottest")
file.write("test")
To test this I ran the script via filebot through commandline. Then I get this error:

Code: Select all

AccessControlException: access denied ("java.io.FilePermission" "/home/myusername/funbottest" "write")
java.security.AccessControlException: access denied ("java.io.FilePermission" "/home/myusername/funbottest" "write")
	at sdy.media.MR.run(Script3.groovy:6)
	at sdy.media.MR$run.call(Unknown Source)
	at sdy.media.Script3.run(Script3.groovy:12)
	at net.sourceforge.filebot.cli.ScriptShell$2.run(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.run(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.run(Unknown Source)
	at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
	at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (°_°)
When I run the script directly from Eclipse it works without a problem.

This is Ubuntu 11.10 with java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

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

Re: Writing a file: permission denied

Post by rednoah » 17 Mar 2012, 18:38

Scripts are sandboxed by default and only allows trusted functions like rename() to mess with your files.

Add -trust-script flag to run Groovy code without any restrictions:

Code: Select all

-trust-script
:idea: Please read the FAQ and How to Request Help.

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

Re: Writing a file: permission denied

Post by rednoah » 17 Mar 2012, 18:49

SeeDoubleYou wrote:So To do some testing I wanted to check whether the script runs by writing the arguments it gets to a file.
btw be careful with "custom arguments". That doesn't work. The filebot cmdline call has to be valid arguments, so you can't specify extra cmdline options. Also all the arguments you add in addition to options will all be considered to be filepaths.

args is File[] of extra arguments/filepaths that are not options/flags
_args is FileBot options (e.g. _args.lang, _args.format, ...)
:idea: Please read the FAQ and How to Request Help.

SeeDoubleYou
Posts: 2
Joined: 17 Mar 2012, 17:53

Re: Writing a file: permission denied

Post by SeeDoubleYou » 18 Mar 2012, 14:26

thank you both! I'll try to fix things later today.

Post Reply