What is happening is that the files created, when the machine state is saved, are given the permissions based on the current user. Therefore, all other users will be disallowed from using these new files.
To fix it, you need to make sure all users are in the same group, and set additional bits on the folder, which will cause all children folders/files inherit the same permissions.
(1) Create a Group for users to share:
Add a group, e.g.:
sudo groupadd vboxsharing
(Note, there is a "vboxusers" group already installed by VirtualBox. It has a specific use, but you can user this existing group rather than adding a new one.)
(2) Add users to the group:
The users who will need access to the shared VMs, need to be added to the group:
sudo usermod -a -G vboxsharing <user1>
sudo usermod -a -G vboxsharing <user2>
# ... etc.
NOTE: You can alternatively set the group as primary for all these users (sudo usermod -g vboxsharing <userXYZ>
), which means you can skip step #3 below. However, doing so is a security risk and should be avoided.
(3) New VirtualBox files to be accessible to the group:
Change the folder's group ownership:
sudo chgrp -R vboxsharing /Users/shared_folder
And, set bits setuid and setgid, as necessary, to ensure future files are created for the group.
Therefore, for your folder, do the following:
sudo chmod -R 6770 /Users/shared_folder
The 6, at the start of the permission bits, is the combination of setuid and setgid:
Technically, you DO NOT need setuid. Therefore, it is enough to have:
sudo chmod -R 2770 /Users/shared_folder
..
Note:
And, you don't need that long find
command, it is a command to apply a different set of permissions to files, and a different set to folders.