Here's the problem:

  1. I create a file called foo.pl containing #!/usr/bin/perl as the top line
  2. I execute chmod u+x foo.pl
  3. I type ./foo.pl at the command prompt and get the following

    bash: ./foo.pl: Permission denied
  4. foo.pl at the command prompt issues the same error

The execute bit on the fill is set

-rwxrw-r-- 1 myname mygroup 73 Sep  4 12:29 foo.pl

Any ideas?

  • I'm assuming your username is, considering the obfuscation, myname? Is this file on a partition other than root partition? Also, you probably meant to say you ran ./foo.pl (I've edited your question).
    – Alaa Ali
    Sep 4, 2014 at 16:42
  • actully, neither foo.pl nor './foo.pl' work; same error both times. And yes, the username and group are correct
    – stacey11
    Sep 4, 2014 at 16:56
  • Okay. Are you the owner of the file? Are you myname? And is this file on a different partition than root? The partition that it is on could have the noexec mount option on it. You can verify that by looking at the options on the partition from the command mount.
    – Alaa Ali
    Sep 4, 2014 at 17:04
  • Is the filesystem in which foo.pl is located mounted as noexec? If you don't know how to do this already, use mount or cat /proc/mounts | column -t
    – MGodby
    Sep 4, 2014 at 17:05
  • Set permission as 'executable' for all(sudo chmod +x foo.pl).Hope it helps!Or you can set $PATH to your present directory and run only foo.pl after executing "chmod +x foo.pl" Sep 4, 2014 at 17:37


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.