[Solved] How to create a shared VM

Discussions related to using VirtualBox on Linux hosts.
Post Reply
korda
Posts: 40
Joined: 28. Apr 2021, 10:58

[Solved] How to create a shared VM

Post by korda »

I have installed VirtualBox 6.1 on Kubuntu 20.04.2. I would like to create a virtual machine shared among different host users.

Practical example of what I would like to do
Monday user Foo turns on the host linux PC, login with their credentials and launch the VM.
Tuesday user Bar turns on the host linux PC, login with their credentials and launch the same VM.
Wednesday user Baz... and so on


I have tried to create a vm into a path external to homedirs (ie /opt), then I have granted 666 attributes to .vdi virtual disk and .vbox conf file.
Such solution doesn't work, since the .vbox conf file can be read/written only from the owner host user, irrespective the 666 attribute. Otherwise an error occurrs: it sounds like hash (???) doesn't meet the (non owner) user.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to create a shared VM

Post by scottgus1 »

korda wrote:I have tried to create a vm into a path external to homedirs
This works on Windows, but does not work on Linux, because of:
korda wrote:the .vbox conf file can be read/written only from the owner host user, irrespective the 666 attribute.
Forum guru Socratis and I had a conversation on this once.

The only way I could see to work-around is this:

Put the VM back in the owner's home folder.
Move the VM's disk file to the public folder that all users can write to.
Make copies of the VM folder, which still contains the .vbox file but not the disk file, in each user's home folder, and register the .vbox file in each user's Virtualbox.
Don't use snapshots and don't allow the users to change the VM's hardware settings or save-state the VM. (Virtualbox does not have a way to 'lock' unauthorized users from changing the VM's settings. You can shut off things in the VM's window GUI using the Settings "User Interface" tab, but savvy users can set them all back. You'll have to enforce this through backups and pink-slip/grounding threats. :lol: )

Another alternative, let each user have their own VM.
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: How to create a shared VM

Post by Martin »

Do the users need to interact with the Virtualbox interface?
If not you could try to implement an autostarting VM owned by a technical user and let the other users connect to it using RDP/SSH/xyz.
korda
Posts: 40
Joined: 28. Apr 2021, 10:58

Re: How to create a shared VM

Post by korda »

Martin wrote:Do the users need to interact with the Virtualbox interface?
If not you could try to implement an autostarting VM owned by a technical user and let the other users connect to it using RDP/SSH/xyz.
Autostart of vm could be a good idea but, for my purposes, I would like to have a one shot vm to launch when needed and stop it after effective use. A more detailed example: onto this vm I will install MS Office. Whenever users need to edit with Word or Excel they will launch vm, edit their files, and stop vm once finished. I don't like solutions like PlayOnLinux for using Windows softwares.
scottgus1 wrote:Put the VM back in the owner's home folder.
Move the VM's disk file to the public folder that all users can write to.
Make copies of the VM folder, which still contains the .vbox file but not the disk file, in each user's home folder, and register the .vbox file in each user's Virtualbox.
How can I register the .vbox file? I have made a copy in each user's home folder, and added from the GUI a new virtual machine pointing to that file. But when I try to launch it error occurs (I'll take care of posting a screenshot next time it happens).
scottgus1 wrote: Don't use snapshots and don't allow the users to change the VM's hardware settings or save-state the VM. (Virtualbox does not have a way to 'lock' unauthorized users from changing the VM's settings. You can shut off things in the VM's window GUI using the Settings "User Interface" tab, but savvy users can set them all back. You'll have to enforce this through backups and pink-slip/grounding threats. :lol: )
Never mind, the other users aren't power users. There is no risk that they could accidentally set something else :lol:
scottgus1 wrote: Another alternative, let each user have their own VM.
Such solution is annoying for admins (me), since they have to mantain more then one centralized vm 8)
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to create a shared VM

Post by scottgus1 »

korda wrote:How can I register the .vbox file? I have made a copy in each user's home folder,
In the main Virtualbox window, Machine menu, Add command, browse to the user's copy of the .vbox file, and open it.

You'll have to clear out the VMs you tried to make.
korda wrote:the other users aren't power users. There is no risk that they could accidentally set something else
Regular users are the ones that bung everything up! :lol:
korda
Posts: 40
Joined: 28. Apr 2021, 10:58

Re: How to create a shared VM

Post by korda »

BTW, ho can I update the title of this discussion by adding a SOLVED tag?
Last edited by mpack on 2. May 2021, 12:21, edited 2 times in total.
Reason: Deleted unnecessary verbatim quote.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to create a shared VM

Post by mpack »

korda wrote:BTW, ho can I update the title of this discussion by adding a SOLVED tag?
Done.
Post Reply