Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I installed Debian in VirtualBox (for various experiments which usually broke my system) and tried to launch the VirtualBox guest addon script. I logged in as root and tried to launch autorun.sh, but I got «Permission denied». ls -l shows that the script have an executable rights.

Sorry, that I can't copy the output -- VirtualBox absolutely have no use without the addon, as neither a shared directory, nor a shared clipboard works. But just for you to be sure, I copied the rights by hands:

#ls -l ./autorun.sh
-r-xr-xr-x 1 root root 6966 Mar 26 13:56 ./autorun.sh

At first I thought that it may be that the script executes something that gave the error. I tried to replace /bin/sh with something like #/pathtorealsh/sh -xv, but I got no output — it seems the script can't even be executed.

I have not even an idea what could cause it.

share|improve this question
1  
Looks like it should work. Try running it with bash explicitly: `bash -x ./autorun.sh". Maybe this will give an additional clue. –  nobar Aug 24 at 6:08
1  
What is output of mount | grep noexec? –  Gnouc Aug 24 at 6:12
    
@Gnouc, you're right, the mounted «cdrom» have the noexec set. Probably you may post it as an answer; meanwhile I am trying to remount it with an exec rights. Hm, I didn't even knew that the filesystem could have such an attribute. –  Hi-Angel Aug 24 at 6:16

1 Answer 1

up vote 8 down vote accepted

Maybe your file system is mounted with noexec option set, so you can not run any executable files. From mount documentation:

noexec

Do not allow direct execution of any binaries on the mounted filesystem. (Until recently it was possible to run binaries anyway using a command like /lib/ld*.so /mnt/binary. This trick fails since Linux 2.4.25 / 2.6.0.)

Try:

mount | grep noexec

Then check if your file system is listed in output.

If yes, you can solve this problem, by re-mounting file system with exec option:

mount -o remount,exec filesystem
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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