How to emulate 600 or 660 permissions on your shared folders

Discussions about using Linux guests in VirtualBox.
Post Reply
skeith22
Posts: 3
Joined: 2. Oct 2022, 20:30

How to emulate 600 or 660 permissions on your shared folders

Post by skeith22 »

my Host OS is currently Windows 11, has anyone successfully emulated the linux permissions on their shared folders?

I wanted to emulate the 600 or 660 permissions on some files, but I can't seem to successfully make it happen.
tinkering on Windows side, doesn't do anything unless you make the files "Read-Only", but that doesn't make it 600 or 660 permission at all, it was like 500 or something.
Galactic
Posts: 83
Joined: 28. Apr 2016, 04:52

Re: How to emulate 600 or 660 permissions on your shared folders

Post by Galactic »

In your Linux guest, do not automount the shared folder. Instead, mount it manually with the correct options.

Here's an example using many of the options. It will mount the "folder_name" shared folder at "/mnt/shared" read-only, with the specified owner and permissions.

Code: Select all

mount -t vboxsf -o ro,uid=1000,gid=1000,dmode=770,fmode=660,dmask=007,fmask=117 folder_name /mnt/shared
Just use whichever options you need and set them appropriately.

You can do the same thing in fstab:

Code: Select all

folder_name /mnt/shared vboxsf ro,uid=1000,gid=1000,dmode=770,fmode=660,dmask=007,fmask=117 0 0
Note: This assumes the vboxsf kernel module is loading before fstab runs. If not, you'll need to find out how to do that on your distro.
skeith22
Posts: 3
Joined: 2. Oct 2022, 20:30

Re: How to emulate 600 or 660 permissions on your shared folders

Post by skeith22 »

My guest distro is Ubuntu 24.04 LTS.

Is this possible to do on just a certain file?
Galactic
Posts: 83
Joined: 28. Apr 2016, 04:52

Re: How to emulate 600 or 660 permissions on your shared folders

Post by Galactic »

You can't do that with a single file. But if you can place that file in its own subfolder (perhaps alongside any other files you want to have the same permissions), then you can bind mount that folder to another location and specify what permissions it should have at that alternate location (see the bindfs command documentation).

Alternatively, you can create multiple VirtualBox shared folders with different permissions. They can even point to the same folder on the host.

If I knew more about exactly what you want to accomplish I might be able to give more specific advice.
johnwood
Posts: 3
Joined: 27. May 2023, 06:39
Primary OS: MS Windows 10
VBox Version: OSE Debian
Guest OSses: Windows

Re: How to emulate 600 or 660 permissions on your shared folders

Post by johnwood »

skeith22 wrote: 10. Apr 2026, 10:18 my Host OS is currently Windows 11, has anyone successfully emulated the linux permissions on their shared folders?

I wanted to emulate the 600 or 660 permissions on some files, but I can't seem to successfully make it happen.
tinkering on Windows side, doesn't do anything unless you make the files "Read-Only", but that doesn't make it 600 or 660 permission at all, it was like 500 or something.connections unlimited
you're hitting a fundamental limitation when trying to directly map Linux permissions like 600 or 660 from a Windows host. Windows NTFS filesystem simply doesn't support Unix-style permissions (owner, group, others) in the same way. The solution lies in configuring the mount options within your Linux guest. When you mount your shared folder, you need to specify 'umask' (or 'dmask' and 'fmask' for more fine-grained control) to simulate the desired permissions. For example, to achieve '600' for files and '700' for directories (a common setup for user-private files), you would typically use 'umask=0077' during the mount operation. This means others have no permissions, and group has no permissions, leaving only owner read/write/execute for directories and read/write for files (if not explicitly restricted by fmask).
Post Reply