The example situation:
- Wish to execute a bash script at
/var/foobah/myscript.sh
- But
/var/
has been mounted usingnoexec
via/etc/fstab
. - How to solve? Using bind mounts.
Firstly, create a directory to hold script(s), located somewhere that has exec rights, then create the target directory on noexec
partition:
$ mkdir --parents /opt/magnetik/foobah