How to provide access to VirtualBox SharedFolder to a Linux user

An easy way to exchange files between the host computer and the VirtualBox guest VM is to setup a shared folder. And in this tutorial, we are going to see how to provide access to a shared folder to an Oracle Linux 8.5 user.

cd /media/sf_SharedFolder
cd /media/sf_SharedFolder

I was trying to install a RPM package I had downloaded from my host computer into the shared folder when I realised that my oracle user had no access to the “/media/sf_SharedFolder” directory (the default location for the VirtualBox shared folder in Oracle Linux):

cd /media/sf_SharedFolder error
cd /media/sf_SharedFolder error

I had previously used the root user to install an other RPM package from the same directory without any issue, the problem was therefore related with the folder permissions. I used the “ls -l /media” command to see the permissions:

/media/sf_SharedFolder permissions
/media/sf_SharedFolder permissions

Only user root and members of the vboxsf group had access to the directory. The solutions were therefore either to connect as root to install the RPM package, modify the directory permissions to allow the oracle user to access it, or add the oracle user to the vboxsf group. I chose the last option as I was planing to install most of the packages with the oracle user.

The command I used to add the oracle user to the vboxsf group was “sudo usermod -a -G vboxsf oracle“:

sudo usermod -a -G vboxsf oracle
sudo usermod -a -G vboxsf oracle

I tried to access the “/media/sf_SharedFolder” directory after executing this command… but without success. I realised that I had to reboot the Oracle Linux VM for these changes to take effect.

/media/sf_SharedFolder access error again
/media/sf_SharedFolder access error again

Therefore I rebooted the VM and I checked again whether the oracle user had access to the shared directory and this time it worked as expected:

cd /media/sf_SharedFolder
cd /media/sf_SharedFolder

The oracle user was now member of the vboxsf group and therefore had access to the “/media/sf_SharedFolder” directory.

Disclaimer

The information contained in this Website is for general information purposes only. We try to keep this information up to date and correct but we make no warranties of any kind about the completeness, accuracy, reliability with respect to the website, the information or the graphics contained on the website for any purpose. Any reliance you place on such information is strictly at your own risk. In no event will we be liable for any loss or damage whatsoever from the use of this Website.

The post How to provide access to VirtualBox SharedFolder to a Linux user appeared first on MyBIJourney

All trademarks are properties of their respective owners.
FacebookTwitterPinterestWhatsAppMail