Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The /mnt/ext is mounted to an ext2 filesystem, an external hard drive. For some reason I can't run scripts from there. Please see the session below.

luntain@plato /mnt/ext $ echo "echo success" >
luntain@plato /mnt/ext $ chmod 777
luntain@plato /mnt/ext $ ./
-bash: ./ Permission denied
126luntain@plato /mnt/ext $ ll
-rwxrwxrwx 1 luntain luntain 13 Jan 23 15:08*
luntain@plato /mnt/ext $ 

I would love to find out why I see the error.

share|improve this question
up vote 14 down vote accepted

Probably there was a noexec attribute set when the filesystem was mounted; maybe it is your distribution 'feature'.

To check it you can execute mount that will show mount options in parentheses, and to remove noexec flag you can use mount -o remount,exec /mnt/ext under root.

Also, make sure you place the exec option after the user option, or the system will still mount your drive as noexec.

share|improve this answer

The file system is mounted with the noexec option.

share|improve this answer

A filesystem mounted noexec only prevents executing the script (i.e., asking the kernel to execute it appropriately based on a magic number or a shebang line). It doesn't prevent you from calling an interpreter on another filesystem mounted exec and passing the script as an argument (or on stdin) to said interpreter. Ergo, if not root, you could have worked around this with just sh

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .