[CentOS] Running shell scripts from external media

Thu Jul 3 15:29:06 UTC 2008
Nicolas Thierry-Mieg <Nicolas.Thierry-Mieg at imag.fr>


James B. Byrne wrote:
> OS=CentOS-5.2
> media=Kingston 512Mb usb key
> 
> Problem:
> As 'root', when running a script resident on the external drive mounted at
> /media/disk I receive the following error:
> 
> /bin/sh: bad interpreter: Permission denied
> 
<snip>
> I deduce from the various bits of information that I have gleaned thatthe
> proper entry in fstab should be something like:
> 
> /dev/sda1 /disk auto defaults,user,exec 0 0
> 
> However, this is an automounted, removable media.  How do I do enable
> execute for this key and retain the auto mount capability?  What impact
> will this have on other usb keys?

I think you have the right diagnostic, the key is mounted with the 
noexec flag.
You can confirm this by typing "mount" when the usb key is mounted.

But I don't know the answers to your questions...

However if it fits your usefase you could invoke the shell yourself:
/bin/sh hello.sh