0

I'm running VirtualBox; host and VM (guest) are both Ubuntu 20.04. I've shared the whole file system of the host (ext4) via VirtualBox Shared Folders capability for VM. I had to add my user on the VM to the vboxsf group. Otherwise, I couldn't access the folder. The shared folder is mounted automatically in /media/sf_ROOT. Now, when I chdir to /media/sf_ROOT/home/..., I see that the files' permissions are 770! and it's different from 664 on the host.

Why? How can I make VB to show the files' permissions correctly, the same as what they are in the host? Even if I use chmod in VM, they're not shown correctly, although they're affected on the files which are located on the host correctly.

1 Answer 1

1

I suspect the problem is that the the user id and group id on the host are different than the uid/gid on the vbox guest. You can check that with the id command run on the host and guest. If they differ, the easiest approach may be to change your uid/gid to make them match. If that's not allowed, you can try to manually mount the shared disk with the uid/gid options - see mount.vboxsf for details. In the following, insert your own uid and gid instead of 1000/1000

sudo mount -t vboxsf -o uid=1000,gid=1000 vbox_share_name /mnt/share_mount_point

If that works, and you want to automount it, you can add this to your /etc/fstab

vbox_share_name /mnt/share_mount_point vboxsf uid=1000,gid=1000 0 0

Since you note that you're share the whole host file system with the guest, this may remap uid/gid on files your don't intend to have changed so keep that in mind.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.