Page 1 of 1

Installing Guest additions using sudo(without root password)

Posted: 2. Aug 2013, 11:02
by hackie
Hi

I just tried to install the new VirtualBox Guest Additions (version 4.2.16.86992) under Ubuntu 12.04 "precise".

I was asked for the password of the root user by a graphical dialog (probably gksu), but since I don't have a passwort set for the root user, I'd rather like to use sudo or gksudo to enter my own user password.

To force this, I copied the whole (virtual) cd to /tmp and modified runasroot.sh as shown below. It is a hack, but it worked for me. Hope this helps someone.

Code: Select all

--- /media/VBOXADDITIONS_4.2.16_86992/runasroot.sh	2013-07-04 16:14:51.000000000 +0200
+++ runasroot.sh	2013-08-02 10:52:57.235571851 +0200
@@ -95,6 +95,12 @@
 ADVICE=$3
 PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/X11/bin
 
+# force using sudo
+SUDO=sudo
+SUDO_COMMAND="`quotify "$SUDO"` -- $COMMAND"
+eval "$SUDO_COMMAND"
+exit
+
 case "$ostype" in SunOS)
     PATH=$PATH:/usr/sfw/bin:/usr/gnu/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/openwin/bin:/usr/ucb
     GKSU_SWITCHES="-au root"

Re: Installing Guest additions using sudo(without root passw

Posted: 2. Aug 2013, 14:44
by Perryg
sudo does operate as root. All you should have had to do is type your password when asked ( if you are in the sudoers list )