How to access shared Virtualbox folders from Ubuntu or generally from Linux

If you are using VirtualBox frequently, you will have found yourself in the situation of having to move files from the Host machine (the main system) to the Guest machine (the emulated system).

 

To do this, if you use Windows as Guest (in the VM), there are no problems. 

In this case it will be enough to create a shared folder with auto-mounting, and have installed the VirtualBox Guest Additions. 

In this way each time you start the Guest, you will find the folder mounted ‘on the network’, which refers to that of the physical system.

 

In case you have to use Linux as Guest system, things get complicated, and you need an additional step, let’s go through it. 

 

Step 1 – Install Virtual Box Guest Additions 

Inside the Linux virtual machine (Ubuntu) 

Open a terminal and acquire root rights with: 

sudo su 

Upload the list of packages

apt-get update 

Install theVirtualBox Guest Additions 

apt-get install virtualbox-guest-dkms 

Reboot the system (the VM), and then turn it off for the next step. 

 

Step 2 – Create the shared folder 

From the Host system, create the shared folder and select it from the virtual machine settings: 

 

 Step 3 – Give access permissions 

To open the newly shared folder, you should give the following order command (on Ubuntu, emulated system): 

sudo adduser [username] vboxsf 

This gives access privileges to the current user in the virtualbox group. 

 

Obviously instead of [username] you have to insert your user in the system: 

if for example on the left of the prompt in the terminal you find written leo@leo-VirtualBox:~$ , it will be leo. 

 

To verify if you have been added run (only for verification, not necessary): 

id [username] 

 

In the list, there should also be 999(vboxsf). 

 You can now access the shared folder, in the Guest system, to the path: 

 Home > Devices > Computer > Media 

 Inside you can find all the mounted folders. Those of VirtualBox will have the prefix “sf_” before the name. 

 

This procedure could also allow the (experimental) use of Bidirectional Drag and Drop. 

Share on Social Media
Scroll to Top