Information Technology | Softwares - Graphics - Programming - Hacking - Security

Aug 15, 2019

Install guest additions virtualbox | Setting share folder- Arch Linux

VirtualBox is a very useful tool to install operating systems inside the main system. However, configuring the Virtualbox to share files and anable Auto-resize Guest Display between your main system and the system you installed in a VirtualBox is not trivial. To day, I will show you how to enable Auto-resize Guest Display and setup shared folder in your Arch VM on Virtualbox.
Install guest additions for Debian:

Install guest additions for your guest system:
First, make sure your Arch is up to date.
sudo pacman -Syu
Then, install kernel headers (not need if your Linux installed kernel-headers). I use the Linux standard kernel so I install with: sudo pacman -S linux-headers
if you use the kernel LTS or Zen, install linux-lts-headers or linux-zen-headers

Next, install the virtualbox-guest-utils package
sudo pacman -S virtualbox-guest-utils
It will show you two package: virtualbox-guest-modules-arch or virtualbox-guest-dkms.
Choose the virtualbox-guest-modules-arch package if you use the Linux kernel and virtualbox-guest-dkms for others kernels like LTS.
I use Linux-headers so I choose virtualbox-guest-modules-arch
See more

After that, enable the VirtualBox kernel modules:
modprobe -a vboxguest vboxsf vboxvideo
sudo systemctl enable vboxservice
Note: you also install guest additions from GuestAdditions.iso by Virtualbox.
reboot, and you will see Auto-resize is enabled

Create a shared folder: 
Go to setting your virutal machine add a folder which you want to share, note: disable "read-only"

Change the user permission for the shared folder:
To gain access to this folder as a regular user, open the terminal in your guest system and add your user to the vboxsf group.
sudo usermod -a -G vboxsf <yourusername>
or sudo usermod -a -G vboxsf `whoami` 
`whoami` command will get your username
e.g sudo usermod -a -G vboxsf laladee
Now, give that user a permission to access the media folder.
sudo chown -R `whoami`:users /media/
e.g sudo chown -R laladee:users /media/

Then, reboot or logout. After that you should be able to access the shared folder as a regular user.


About Us