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.

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):

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:

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“:

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.

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:

The oracle user was now member of the vboxsf group and therefore had access to the “/media/sf_SharedFolder” directory.
Disclaimer
The post How to provide access to VirtualBox SharedFolder to a Linux user appeared first on MyBIJourney