Page 1 of 1

vbox owner changed after using with multiple users

Posted: 4. Oct 2016, 11:17
by farkas
Hi,

I have started to use a common guest vm on a shared host desktop computer.
Users launch the vm on different days.
user1 was the owner of all the files in the folder of the vm.
two days ago user2 turned on the VM tested it then turned off.
today user1 was not able to use the same vm - it was reported as unaccessible by vm manager.
cheched the files and all was there but the .vob and .vbox-prev files changed. Their owner is now the user2.

I think this is a bug.
Why owner has changed? user2 already had read-write access to the files?

Re: vbox owner changed after using with multiple users

Posted: 4. Oct 2016, 11:30
by farkas
my version is
VirtualBox Graphical User Interface
Version 5.0.26 r108824
Copyright © 2016 Oracle Corporation and/or its affiliates. All rights reserved.

Re: vbox owner changed after using with multiple users

Posted: 4. Oct 2016, 13:02
by socratis
Unfortunately, this is not due to VirtualBox's behavior. This is your OS doing all the ownership/permissions. You have to search for your specific operating system (you never mentioned it) on how to implement shared files where the users can "share" each other's changes. Maybe it's good enough if you simply give the 'group' of the users read-write access.

On my OSX host, you have to change the 'umask'. The method varies, depending on the OSX version. For OSX this changes the global behavior of the system, so I haven't done it. Plus it doesn't actually work...

Re: vbox owner changed after using with multiple users

Posted: 4. Oct 2016, 17:34
by farkas
I have a:
Linux 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

I have found a workaround, created a separate copy of the vbox for all the users.

Re: vbox owner changed after using with multiple users

Posted: 4. Oct 2016, 17:45
by socratis
As long as there is no snapshots or earth-shattering changes, that could work, although I expect turbulence. By "earth-shattering changes" I mean anything vital to the VM: RAM, vRAM, hardware acceleration, hard drives, CDs, RAM, shares appearing/disappearing, USB filters, audio. You know... the details.

Why don't you simply give the whole folder/subfolders "group+rwx" and be done with it?

Re: vbox owner changed after using with multiple users

Posted: 5. Oct 2016, 10:21
by farkas
tried it but not working.
created a common group called vboxshare
assigned all users
changed the vbox folder permission to vboxshare+rw
Using a single vbox file has the above mentioned problem
after user1 launched the vm, she will be the owner of the common vbox file.
user 2 cannot use the same vbox file. VM is unaccesiible for her.

So I will use the 2 vbox file for the same vm

Re: vbox owner changed after using with multiple users

Posted: 5. Oct 2016, 11:31
by Martin
Vbox is designed as a single user application and makes sure that the relevant files belong to the user. ;)
When you get outside the design specification you need to use some tricks to work around this.

Re: vbox owner changed after using with multiple users

Posted: 5. Oct 2016, 11:54
by socratis
Martin wrote:Vbox is designed as a single user application
This I agree with. And that, only in the sense that you cannot have multiple users running the same VM with the default setup concurrently. You can however set it up with immutable images and different snapshot directories and actually make it work. Of course, technically, it's not the same VM, but you get my drift.
Martin wrote:and makes sure that the relevant files belong to the user.
This I don't agree with. VirtualBox does not set or change permissions. It couldn't care less. It's the host that's doing this. For example VirtualBox has no problem whatsoever working with a similar scenario on a Windows host (I just tried it). It's the POSIX hosts that are having "trouble" with shared files/folders.

Re: vbox owner changed after using with multiple users

Posted: 5. Oct 2016, 12:23
by Martin
My "interpretation" is that Vbox just uses standard linux functions to recreate the files from a process running under the current user account.

Re: vbox owner changed after using with multiple users

Posted: 5. Oct 2016, 19:16
by socratis
Exactly right! The problem as I mentioned is the creation permissions mask of the underlying OS.

So, for example the 'umask' for newly created files on OSX (that I'm mostly familiar with) is 0228 and if you combine it with the default create permissions of 7778 you get a file with 7558 or else, 'rwxr-xr-x', aka read-write for the owner and read-only for everyone else. If you want to change that, you'll have to change it throughout the system. Bummer...

Re: vbox owner changed after using with multiple users

Posted: 5. Oct 2016, 19:48
by Martin
Yes, this way you could change access rights for the group, but Vbox would still change the file owner to the last user accessing the file.

Re: vbox owner changed after using with multiple users

Posted: 5. Oct 2016, 22:06
by socratis
No, it's not about accessing a file, it's about creating a new file. Actually if I'm not mistaken it goes like:
- Create ".vbox-temp" to keep any run-time changes (owner is the user that runs VirtualBox).
- After it's done, remove ".vbox-prev". Rename ".vbox" to ."vbox-prev".
- Rename ".vbox-temp" to ".vbox".
So, the".vbox" is not simply accessed, it's created as ".vbox-temp" and then renamed to ".vbox".

Re: vbox owner changed after using with multiple users

Posted: 7. Oct 2016, 09:08
by farkas
Seems to me the creation of duplicates of vbox with the same content prefixed or suffixed with username like:
W10User1.vbox
W10User2.vbox
is a good solution.

Re: vbox owner changed after using with multiple users

Posted: 7. Oct 2016, 10:00
by socratis
I highly doubt that this will be implemented, as VirtualBox documents (VMs) are, by design, not to be shared. If you want to use VirtualBox in an unsupported fashion, you have to sure that it works, i.e. hack your system's setup so that it covers the scenario you've envisioned. But, you can always try to make a suggestion in the "Suggestions" sub-forum...

Re: vbox owner changed after using with multiple users

Posted: 10. Oct 2016, 09:34
by farkas
Thanks for the info about how this file handling works, and why the owner changed.