Perl Script Permissions

6,363

Solution 1

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

Solution 2

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:

#!/usr/bin/perl

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.

Share:
6,363
Thibault
Author by

Thibault

I'm a music education major at Shepherd University. I couldn't stand the limitations that OSX/Windows gave me, so I made the switch to Linux. Started out with Ubuntu 11.04, survived up until 12.04, and after my system crash as I upgraded to 12.10, I decided to switch to Arch Linux as my default distro. IRC: ryanmcclure

Updated on September 18, 2022

Comments

  • Thibault
    Thibault over 1 year

    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?

    • Panther
      Panther about 12 years
      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 ?
  • Thibault
    Thibault about 12 years
    The script is executable, the script begins with #!/usr/bin/perl -w and both of those returned "Ok" Any thoughts?
  • Keith Thompson
    Keith Thompson about 12 years
    I don't know what runescape is. Is it invoking the script as a user that doesn't have the required access?
  • Thibault
    Thibault about 12 years
    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?)
  • Thibault
    Thibault about 12 years
    Oh, and I only receive this message with this script.
  • Keith Thompson
    Keith Thompson about 12 years
    @RyanMcClure: See my updated answer.
  • Thibault
    Thibault about 12 years
    It worked, but it still did not display later. Under terminal, I found every instance of "Permission Denied" and it all dealt with "Javabin" in one way or another...do you know what Javabin is?
  • Thibault
    Thibault about 12 years
    Fixed!!!!! I had to remove my java and reinstall it. And now it works. Turns out it wasn't perl-related at all. Thank you so much for your help, I appreciate it!!!