Cannot Access Shared Folder Through Linux Guest on Virtualbox: Permission Denied

Case: Running Virtualbox 7 on Debian 12 Bookworm, the guest Linux OS fails with message: `Error opening directory: Permission denied.`

Solution

On the Linux guest:

  1. CLI: Navigate to /media or /mnt directory (where the shared folder is; depending on distro)
  2. ls -la to check group ownership of the shared folder
  3. Add current user for the guest OS to the displayed group.
    Example with group vboxsf: sudo usermod -a -G vboxsf $USER
  4. Reboot virtual machine

Notes:

  • sf*_ Folder Belongs to ‘root’ Group
    If after applying the fix, ‘ls -la’ shows the sf_* folder belonging to ‘root’ group:

    1. poweroff VM,
    2. unmount it through the virtualbox interface,
    3. start VM,
    4. remove the folder with ‘sudo rm -drf <folder>’,
    5. poweroff VM; and
    6. share the folder again (check auto-mount, other options: unchecked)
  • Share folders with VM powered-off, use auto-mount.

Source

Did this solve your issue?