I'm having a few problems with running a Perl script. Every time I try to run it (its from a runescape launcher client), it give me the following message in terminal: Permission Denied

How can i fix this?

  • Where is the script located and what are the permissions on the script ? Does it run if you chmod a+x /path_to/your_script ? – Panther Feb 26 '12 at 3:35

There are two possibilities.

  • The script itself doesn't have execute permissions. Solution:

chmod +x script-name

  • (less likely) The interpreter specified on the shebang line is not executable.

Normally the first line of the script should be:


If it is, and if the script itself is executable, then try this:

if [ -x /usr/bin/perl ] ; then echo ok ; else echo OOPS ; fi

or, if your default shell is csh or tcsh:

sh -c 'if [ -x /usr/bin/perl ] ; then echo ok ; else echo OOPS ; fi'

If that prints ok, then something very strange is going on. If it prints OOPS, then your Perl interpreter is not executable -- which probably indicates that it was installed incorrectly. If that's the case, I'm not going to suggest a quick fix.

Another thought: Does the message result from executing the script itself, or from something it does?

Do you see the error when you execute the script from a command line? If so, if you add

print "Hello\n";

near the top of the script does "Hello" appear before the "Permission denied" message? If so, then the problem is somewhere in the script (about which we have no information). You should be able to narrow it down yourself.

|improve this answer|||||
  • The script is executable, the script begins with #!/usr/bin/perl -w and both of those returned "Ok" Any thoughts? – Ryan McClure Feb 25 '12 at 4:30
  • I don't know what runescape is. Is it invoking the script as a user that doesn't have the required access? – Keith Thompson Feb 25 '12 at 4:41
  • It's a Java-based MMORPG. I can play it on my browser, but I feel like a client would be more stable. It worked on a previous Ubuntu install before I did a clean install. I redownloaded the client and now this happened. Would you like me to post the script? (If that's allowed?) – Ryan McClure Feb 25 '12 at 4:46
  • Oh, and I only receive this message with this script. – Ryan McClure Feb 25 '12 at 5:04
  • @RyanMcClure: See my updated answer. – Keith Thompson Feb 25 '12 at 8:03

I figured out what it was. It had to do with my Java installation.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.