Multiple Host User IDs accessing the same VM

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
andre-CA
Posts: 36
Joined: 27. Feb 2010, 10:14
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: XP Pro SP 3

Multiple Host User IDs accessing the same VM

Post by andre-CA »

I exported a VM from my MacBookPro and imported it onto my iMac (using the export / import vb commands). Everything worked fine. I was logged into my account on my iMac when I did the import. It put the virtualbox files in a folder /users/myID/Library/VirtualBox/... Now when another user logs into the iMac they do not have access to the VM. (they also do not have access to the Library folder under my account). I want several of the users (my family) to have access to the virtual machine which is now located in my library.

I am looking for the quickest, easiest way to allow multiple users on the local machine (iMac) to access the virtual machine that is currently stored in my library. I am new to the Mac and to Virtual Box. I have read the manual and spend hours on the forums.

I am running snow leapard 10.6.2 and Virtual Box 3.1.4

A couple other notes / observations the original had 4 snapshots all .VDI files - the new iMac VB has a single .vdmk files which is much larger than the combined .vdi files. I don't know if it matters - but it would be nice to have a single (larger) .vdi file in both locations as I only allocated 20 gig and the .vdmk is over 16 gig. The host only reports that 10 gig has been used.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Multiple Host User IDs accessing the same VM

Post by Perryg »

By default when you create a VM (as a specific user) VirtualBox puts this in your home folder.
As such this would not be available to another user for security reasons (of the operating system not VirtualBox).
You can however make a common folder to store this in and then re-direct VirtualBox to use this folder to store the VM and that would be available to other users.
You would need to change the preference or the VBOX_USER_HOME environmental variable. See section 9.1. VirtualBox configuration data of the VirtualBox Users Manual.

When you export a VM that has snapshots the snapshots are included in the original VM otherwise you would have just the base VM and not the state it is now.
andre-CA
Posts: 36
Joined: 27. Feb 2010, 10:14
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: XP Pro SP 3

Re: Multiple Host User IDs accessing the same VM

Post by andre-CA »

Perryg wrote:By default when you create a VM (as a specific user) VirtualBox puts this in your home folder.
As such this would not be available to another user for security reasons (of the operating system not VirtualBox).
You can however make a common folder to store this in and then re-direct VirtualBox to use this folder to store the VM and that would be available to other users.
You would need to change the preference or the VBOX_USER_HOME environmental variable. See section 9.1. VirtualBox configuration data of the VirtualBox Users Manual.

When you export a VM that has snapshots the snapshots are included in the original VM otherwise you would have just the base VM and not the state it is now.
Thanks for your quick reply. I am a novice with both VirtualBox and Mac - so I appologize in advance for needing specifics. I do understand your answer and I have read the manual. However - I just want to be sure that the following steps will work, and if not what I need to do to correct them.

To make my EXISTING VM (and all future VMs) available to all users on my iMac:

1. MOVE the virtualbox folder and all of it's contents and subfolders to a shared folder (like /user/shared/virtualbox)
2. In order to make this new shared folder available, VirtualBox needs to be redirected to this new folder. You suggest changing the preference OR the VBOX_USER_HOME environmental variable (per section 9.1 in the user manual).
Can you give me step by step instructions on how to change the VBOX_USER_HOME environmental variable in Mac OS X 10.6.2?
It looks like the alternative is virtualbox GUI preferences menu and then change the general settings for the default hard disk folder to point to the shared folder and change the default machine folder to point to the shared folder as well.

Can you please confirm the following - these changes will allow access to my EXISTING VM (in the NEW shared location - after I move the virtualbox folder there) and not just new VMs that I create? It seems that the XML files have information in them that may point to the current (old) location of the files especially if I use method 2 and the environmental varrriale is NOT changed. If this won't work for EXISTING machines then I need to know how to make that work. Thanks again!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Multiple Host User IDs accessing the same VM

Post by Perryg »

I can't help you so much with the MAC host but I would suggest that you copy instead of moving (at least until you get it to work)
But the theory you state should work. You would set the variable in the preferences and as long as each user is in the vboxusers group they should be able to run the VM (just not at the same time of course). The main virtualbox.xml would then be updated when you change the preferences.
andre-CA
Posts: 36
Joined: 27. Feb 2010, 10:14
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: XP Pro SP 3

Re: Multiple Host User IDs accessing the same VM

Post by andre-CA »

I copied the folder to the new location. Then I logged in as the new user and I set the 2 virtual box preferences to point to the new hard disk folder and the new machines folder. I closed and reopened virtual box as the new user. The existing VM is NOT listed for the new user. Perhaps there is something else I need to change? Something under virtual media manager? I don't want to mess anything up. Thanks again for your help.

The other possibility (and I am a complete novice here) is that the permissions need adjustment? I can get to a unix shell from the terminal window and I noticed the following:

the new folders and directories under the /users/shared/ folder all have my username and group "wheel" - i don't know what that group is at it appears to be system generated. The permisions on the VB folders Machines and HardDisks are drwxr-xr-x and virtualbox.xml is -rw------- and compreg.dat and xpti.dat are -rw-r--r--

The hard disk .VMDK file is also owned by be with -rw------ group wheel. If you think I should play with the permissions at the unix level of Mac OS X please let me know the specifics. I am unfimiliar with the group wheel and I don't remember the syntax for changing the permissions and I am not sure what to change them to. Perhaps there is an easier way to do this. Also the maual seems to warn against this type of copying / moving the folder - but does not give me details regarding how to accomplish this. If the OS X part of this is problematic is there someone else who might be able to take a look at this? I think this is a fairly common question that I can't find a working solution for. Again - many, many thanks!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Multiple Host User IDs accessing the same VM

Post by Perryg »

Wheel would be the super user account. As I said I am not that much on MAC but if I were doing this I would add vboxusers group to the folder as a permission level. That way anyone that is in the group vboxusers would have permission to access the folder and they would need read,write. Probably permission 664.

Of course you can try or wait for a MAC user. But the basic Linux commands work in MAC I think.
andre-CA
Posts: 36
Joined: 27. Feb 2010, 10:14
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: XP Pro SP 3

Re: Multiple Host User IDs accessing the same VM

Post by andre-CA »

What about the "Virtual Media Manager" in virtual box?

If there is anyone else who could help me with step by step Mac OS X (or unix) instructions that would be much appreciated.

Edit after many hours of testing:
I am still frustrated. I added a vboxuser group to my Mac OS X accounts using the Mac GUI. I then added the new account that is trying to access the VM in the new location to the vboxuser group. I then went to every file and folder under the new shared copy of the VirtualBox folder including the virtualbox folder itself and added RW permission for the vboxuser group. Then I rebooted. Then I edited the VirtualBox.xml file and changed the path to point to the new shared Hard Drive. Then I ran VirtualBox and I went to the virtual media manager and added the hard drive from the shared folder. Then I rebooted. When I ran virtualbox as the new user the VM still does not appear in my list. I then tried to create a new test VM (empty) and it created the VM and the Drives in the shared folder, but the original VM that I need still does NOT appear in the list. Please help as I don't know what to try next. If someone knows Mac OS X as a host and can help with this I would really appreciate it.

Many Thanks.
brianpratt
Posts: 2
Joined: 30. Jun 2010, 13:21
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7

Re: Multiple Host User IDs accessing the same VM

Post by brianpratt »

Here's a good way to make it work, though it doesn't use the VBOX_USER_HOME as recommended:

http://aaronadams.net/2010/05/02/sharin ... ple-users/

You basically set up symlinks and set the permissions for all the VirtualBox files so all users can access and modify them.
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

Re: Multiple Host User IDs accessing the same VM

Post by ChipMcK »

For environmental variables, I found this article to be a good starting point
http://dhptech.com/article/2007/02/09/s ... x-programs

Best Reading!
Tolomaüs
Posts: 2
Joined: 17. Jul 2010, 12:59
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Multiple Host User IDs accessing the same VM

Post by Tolomaüs »

I have tried by setting the following ACL's:

sudo setfacl -m g:vboxusers:rw /home/shared/.VirtualBox/VirtualBox.xml
sudo setfacl -m g:vboxusers:rw /home/shared/.VirtualBox/VirtualBox.xml-prev
sudo setfacl -m g:vboxusers:rw /home/shared/.VirtualBox/Machines/<name>/<name>.xml
sudo setfacl -m g:vboxusers:rw /home/shared/.VirtualBox/Machines/<name>/<name>.xml-prev

On first sight this seems to work.

Prerequisites:
- sudo apt-get install acl
- add the acl option to the filesystem in fstab
Tolomaüs
Posts: 2
Joined: 17. Jul 2010, 12:59
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Multiple Host User IDs accessing the same VM

Post by Tolomaüs »

Please ignore my previous post. It seems that he file is recreated each time, thereby ignoring obviously the previous file's permissions.
Post Reply