Can't execute a script on a mounted external drive

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.


The file system is mounted with the noexec option.


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 k.sh.