Kali Linux VM: Permission denied to run shell script, as root

17

4

I've just installed Kali Linux (Debian) in a VirtualBox VM. I want to install the VBOX Additions that will allow me to configure things like screen resolution (hopefully).

My problem is running the install script. I'm root, I've chmoded everything, I have the rights to execute the script but I still get 'Permission Denied'. I've tried with sudo as well.

Check the screen below:

enter image description here

user2018084

Posted 2014-06-12T20:35:23.750

Reputation: 1 604

https://docs.kali.org/general-use/kali-linux-virtual-box-guest – tombolinux – 2018-05-04T13:50:40.787

What happens if you give the it 7XX permissions? – Matthew Williams – 2014-06-12T20:54:40.003

Answers

14

It might be that the /media/cdrom0 filesystem has the noexec flag set. You can check this with:

mount -v | grep cdrom0

If there is noexec between the parentheses, files on the filesystem are not executable. (like (noexec,nosuid,nodev))

You can try remounting the filesystem with the exec flag:

sudo mount -o remount,exec /media/cdrom0

Alternatively you can copy all files to disk and run the scripts from there.

mtak

Posted 2014-06-12T20:35:23.750

Reputation: 11 805

1

Moreover, one needs build-essential, module-assistant and kernel's headers. Here there is a nice summary of things to do for getting VBoxLinuxAdditions.run to play nicely.

– Atcold – 2015-11-02T05:57:25.203

copying the files is the fastest way. – Tomáš Zato - Reinstate Monica – 2016-03-23T10:41:33.400

7Running bash < ./autorun.sh should also work. – Kenster – 2014-06-13T14:06:11.873

6Indeed, never thought about that. As a variation, sh autorun.sh is more commonly used. – mtak – 2014-06-13T15:03:28.410

0

The file you want to run is VBoxLinuxAdditions.run , the files named runasroot.sh and autorun.sh will return that error even if you do change the attributes.

After you copy the contents of the Guest additions ISO to a folder on the guest machine if it appears in green text when listed in a terminal then it is already executable. If not you can type into a terminal after navigating to the directory where you saved the files on the guest machine. chmod -x VBoxLinuxAdditions.run or just right click on it and select properties and then select the permissions tab and click the execute checkbox - allow executing as a program.

Bell

Posted 2014-06-12T20:35:23.750

Reputation: 1

-2

The problem is due to the permission not set to executable to fix this

FIX 1

COPY THE EXECUTABLE TO THE HOME DIRECTORY AND THEN RUN THESE COMMANDS

chmod -x filename.sh

./filename.sh

it should work..

Fix 2

Change the permission of the file system in which the *.sh file is located.

Mrinal Paul

Posted 2014-06-12T20:35:23.750

Reputation: 1