I'm in the process of setting up a clean install of Ubuntu 22.04 LTS Desktop and I'm trying to share the same VirtualBox v7.0.6 VMs between users in order to save myself both effort and disk space. I have an administrator user and two regular users, one for work, and one for study; and if I have a separate Windows VM and Kali VM for all three users, not only will I have to configure everything three times, but I will also, quite likely, run out of storage.
My first line of attack was to add my users to the group "vboxusers" and make a new directory called "/opt/vmshare" in which I have started to place my virtual machines. I changed the ownership of all the files in my first VM from the likeness of...
-rw------- 1 administrator administrator 3592 Feb 26 16:37 bumbleBee.vbox
...to...
-rw-rw---- 1 administrator vboxusers 3592 Feb 26 16:40 bumbleBee.vbox
...but every time I start the virtual machine with whatever user it rewrites the vbox files like so...
-rw------- 1 study study 3592 Feb 26 16:43 bumbleBee.vbox
-rw------- 1 study study 3592 Feb 26 16:43 bumbleBee.vbox-prev
...and I have used chown and chmod again (you can swap out "study" for either of the other users).
I can set the group sticky bit on all the virtual machines root directories to keep the group as "vboxusers" which results in the following permission after I run the vm...
-rw------- 1 study vboxusers 3592 Feb 26 16:46 bumbleBee.vbox
-rw------- 1 study vboxusers 3592 Feb 26 16:46 bumbleBee.vbox-prev
...but the group is still locked out. Can anyone think of a solution? Will changing my umask be useful?