4

This question already has an answer here:

Well I'm just too green to Linux, but I'm stuck with a thing that I should know, and I don't. My file has the following permission bits sets:

-r-xr-xr-x

is owned by root ( but it should not matter since -x is active even for any user) it is not writable, and since it resides on a CDROM even if is a virtual iso mounted as a cdrom it sounds ok, but I can't execute: It says "Permission Denied" What I miss? The mount itself has execution permission, so it should execute, why it does not?

EDIT

I solved the issue, but not my doubt, since expliciting bash ./autorun.sh works - i need a root account anyway for what's inside, but it works.

marked as duplicate by Ignacio Vazquez-Abrams, Anthon, slm, jasonwryan, Thomas Nyman Nov 28 '13 at 5:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Where is it mounted to exactly? Perhaps it needs write access to perform a task, it would help to know something about the app. – Gregg Leventhal Nov 27 '13 at 19:46
  • was automounted by virtualbox, it is part of the "Guest Additions" – Felice Pollano Nov 27 '13 at 20:29
  • 2
    Since it's a cdrom and an automount, it's likely mounted with the noexec option. This prevents anything from being executed from that filesystem. You can disable the noexec option by remounting with mount -o remount,exec /path/to/mount. – Patrick Nov 27 '13 at 21:38
7

The most likely explanation is Patrick's: the filesystem is mounted with the noexec option, so the execute permission bits on all files are ignored, and you cannot directly execute any program residing on this filesystem. Note that the noexec mount option is implied by the user option in /etc/fstab (supposedly for security reasons, even though unlike the nodev and nosuid options, noexec does not in fact provide any security). If you use user and want to have executable files, use user,exec.

It's also possible that the shebang line of the script points to a file that exists but isn't executable — in that case, the error message confusingly refers to the script even though the error is with the interpreter. However it's unlikely that the shebang would point to a wrong existing file (if the error was “not found”, a dangling shebang would be more plausible).

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