How to install guest additions on VirtualBox

Debian 8

Switch to root and install the latest updates:

username@debian:~$ su
root@debian:/home/username# apt-get update && apt-get upgrade

Stop apt-get prompts for CDs/DVDs when installing packages:

root@debian:/home/username# nano /etc/apt/sources.list

Comment out (by adding # at the beginning of the line) or remove the line starting with:

deb cdrom:[some name]/ stable main


Install guest additions

root@debian:/home/username# apt-get install build-essential module-assistant

Configure your system for building kernel modules by running:

root@debian:/home/username# m-a prepare

Click on Insert Guest Additions CD imageā€¦ from the VirtualBox Devices menu.

root@debian:/home/username# cd /media/cdrom/
root@debian:/home/username# sh ./

Now reboot your machine.


Install sudo
sudo is not installed by default in Debian. More accurately if you specify a root password during the installation of the system, sudo won’t be installed by default. If you do not set a root password, sudo will be installed.

You can install sudo and add your username to sudoers file following this guide:

Switch to root:

username@debian:~$ su

Install sudo:

root@debian:/home/username# apt-get install sudo

Grant users administrative privileges:

root@debian:/home/username# visudo

You will be taken into a text editor session with the file that defines sudo privileges. Find the part of the file that is labeled “User privilege specification” and add the new user to this file to grant desired access rights.

# User privilege specification
root        ALL=(ALL:ALL) ALL
newuser     ALL=(ALL:ALL) ALL

WriteOut with ctrl+O and exit with ctrl+X.

Now exit root access and test the sudo user access:

root@debian:/home/username# exit
username@debian:~$ sudo apt-get update && sudo apt-get upgrade
[sudo] password for username:

Leave a Reply

Your email address will not be published. Required fields are marked *