Sharing Permissions for Shared Folders in VirtualBox on Windows 10 and Ubuntu 20
Abstract: Resolve permission errors for VirtualBox shared folders on Ubuntu by adding users to the vboxsf group or adjusting mount options.
2026-08-24
Created: 2026-08-24 by
UserComp.com Editors
To share folders between a Windows 10 host and an Ubuntu 20 guest in VirtualBox, you must enable the feature in VM settings, install Guest Additions for seamless integration, and configure Linux permissions manually. By default, mounted shares are owned by root with restricted access. You can resolve this by adding your user to the vboxsf group or adjusting mount options to assign ownership directly during the mounting process. This ensures read-write access without security compromises.
Configuring Shared Folders in VirtualBox Settings
The first step involves telling VirtualBox which directories from your Windows 10 host should be visible to the Ubuntu 20 guest. Open the VirtualBox Manager, select your Ubuntu virtual machine, and click on Settings. Navigate to the Shared Folders category in the left-hand menu. Click the icon to add a new shared folder entry. In the dialog box that appears, use the folder path button to browse your Windows host file system and select the directory you wish to share.
Enter a descriptive name for the share; this is the identifier used within the Linux guest, not the Windows path. Check the Auto-mount box if you want the folder to appear automatically upon boot. It is often safer to uncheck Make Permanent while testing to avoid configuration clutter. Finally, ensure Read-only is unchecked if you intend to write files from the Ubuntu guest to the Windows host. Click OK to save these settings. This action prepares the environment but does not yet grant the Linux user access to the data.
Installing VirtualBox Guest Additions
Shared folders rely heavily on the VirtualBox Guest Additions, which provide drivers and system applications for optimal performance. Without these additions, the shared folder may not mount correctly, or performance will be severely degraded. Start your Ubuntu 20 guest and open a terminal. Update your package lists by running sudo apt update. Then, install the necessary build tools and kernel headers required to compile the guest modules using sudo apt install build-essential dkms linux-headers-$(uname -r).
Once the dependencies are installed, insert the Guest Additions CD image by selecting Devices > Insert Guest Additions CD Image from the VirtualBox menu bar. Mount the CD and run the installation script. Alternatively, you can install them via the repository by running sudo apt install virtualbox-guest-additions-iso followed by the standard installation commands. After installation, reboot the virtual machine. This step is critical because it enables the vboxsf filesystem driver that allows Ubuntu to interpret the shared folder structure provided by the Windows host.
Fixing Permission Errors in Ubuntu
Even with correct configuration, you might find that you cannot create, delete, or modify files in the shared folder due to permission restrictions. The shared folder is typically mounted under /media/sf_YourShareName. To check who owns this directory, use the command ls -ld /media/sf_YourShareName. By default, the owner is root and the group is vboxsf, with permissions that deny access to regular users.
There are two primary methods to fix this. The first method involves adding your current user to the vboxsf group. Run sudo usermod -aG vboxsf $USER. Log out and log back in for the group change to take effect. This grants your user access to all shared folders managed by VirtualBox. The second method is more granular: you can specify the UID and GID of your user when mounting the folder manually. Create a custom mount point, such as mkdir ~/shared, and then mount the share using specific flags: sudo mount -t vboxsf YourShareName ~/shared -o uid=$(id -u),gid=$(id -g). This approach gives your user direct ownership of the specific mount point, bypassing the global group restriction.
Verifying Read-Write Access
After applying the permission fixes, verify that the setup works correctly. Navigate to the shared folder location using cd /media/sf_YourShareName or your custom mount point. Try creating a test file using touch testfile.txt. If the command succeeds, the permissions are correctly configured. You can also try copying a file from your Windows host into the folder to ensure bidirectional communication is stable.
If you encounter errors such as "Permission denied" despite being in the vboxsf group, ensure that the Auto-mount option was enabled in the VirtualBox settings. Additionally, check the VirtualBox logs located in the VM's directory for any mounting errors. For persistent issues, consider checking if SELinux or AppArmor policies are interfering, though this is rare in standard Ubuntu desktop installations. Properly configured shared folders provide a robust bridge for development workflows, allowing you to edit code on Windows while running tools in Linux. For more complex virtualization setups, such as nested environments, see how to handle nested virtualization issues in VirtualBox.
Frequently Asked Questions
Why is my shared folder showing as empty?
This usually happens if the Guest Additions are not installed or if the auto-mount failed. Ensure the vboxsf module is loaded by running lsmod | grep vboxsf. If it is missing, reinstall the Guest Additions and reboot the VM.
Can I share multiple folders at once?
Yes, you can add multiple entries in the Shared Folders settings panel. Each entry will be mounted separately under /media/sf_ followed by its unique share name. Apply permissions to each mount point individually if needed.
Do shared folders work over a network?
No, VirtualBox shared folders operate locally within the hypervisor layer. They do not use SMB or NFS protocols accessible from outside the VM. For network sharing, you must configure a network adapter type like Bridged or NAT in the VM settings.
What if I get a "Mount Error" on boot?
This indicates a mismatch between the host share name and the guest expectation. Check the VirtualBox settings to ensure the share name matches exactly what you typed in the mount command. Also, verify that the host folder still exists at the specified path.
Is it safe to write large files to shared folders?
Writing large files is generally safe but can impact performance due to the overhead of the virtual file system interface. For heavy I/O operations, consider using a virtual disk image attached to the VM instead of a shared folder for better speed and reliability.