I have a computer with Ubuntu 14.04, with several user accounts. In one of those accounts, I have a virtual machine in VirtualBox. I would like to share that virtual machine with the other users of the computer. How can I do it?

  • 2
    Share it how ? As long as the VM is running users should be able to connect to it via ssh, vnc, etc. – Panther Apr 25 '14 at 18:19
  • I meant, have access to the same virtual machine, from other users. – user246185 Apr 25 '14 at 18:26
  • you need to be more specific. You can configure the VM to start at boot. As long as the VM is running, users have many ways of accessing the machine, ssh, ftp, http, samba, vnc, shared directories ... – Panther Apr 25 '14 at 18:41

The idea

To make a VM available from different user accounts on one computer (not having it running at the same time), you need to set up a few things:

  • Locate the virtual hard drive of the shared machine in a directory where different users have appropriate permissions.
  • Create virtual machines on the different accounts, using that same virtual hard drive.

How it can be done

  • Create a shared folder, in your personal home folder, for you and other user(s):

    • Make other users member of the group yourusername (the easiest way is to install gnome-system-tools and use the users and groups -section. Manage groups > choose_yourusername > properties > add_other_users (detailed instructions here to mange users, and here to create a shared folder)

    • Change the permissions of the folder; right-click on in nautilus. In the permissions tab, change the group permissions for group yourusername to read & write.

    • Change the permissions for the files in the folder similarly (the button down in the nautilus properties window).

  • Create a virtual machine in VirtualBox. Do not use the default directory for a disk, but browse to the shared folder and save the disk image there. If you have an existing VM, delete it, delete its folder in ~/VirtualBox VMs as well, but keep its disk image, and move it to the shared folder first, then create a new VM, using the existing image as a harddisk. (if you try to relink the disk image in your existing VM, VirtualBox will complain the UUID already exists).

  • On the other user's account(s), create similar machines, but use the hard disk image in the shared directory: /home/yourusername/shared_folder/machine_name.vdi (depending on the diskimage you created)
| improve this answer | |
  • Not a good idea for multiple users to boot the VM at the same time. – Panther Apr 25 '14 at 20:15
  • @bodhi.zazen , NONO! but I assume it is on one machine, not at the same time! – Jacob Vlijm Apr 25 '14 at 20:16
  • See the comment I made. Have user 1 make a VM, have the VM automatically boot, and connect to the VM via VNC or SSH or whatever. – Panther Apr 25 '14 at 20:22
  • Sorry for the lack of precision, what I meant is to make the same VM available from different user accounts, not running it at the same time. (I don't even imagined the possibility of run the VM on mutiple accounts at the same time) – user246185 Apr 26 '14 at 1:01
  • @user246185 Perfect! It was indeed how I read your question at first, but then I had to exclude the theoretical possibility that you would (try to) run them from more accounts at the same time. – Jacob Vlijm Apr 26 '14 at 4:27

it's easier to just set file permissions for particular VM for user group.

I doesn't matter where it is, you don't have to delete and redo anything.

In my case it was in my \home\ folder and I just set file permissions to read/write for user group where the other user was.

Then log in as this other user, enter Virtualbox > Machine > Add and navigate to vmdk (or other format) file of this particular VM.

No issues. No idea why you need to create new VM.

| improve this answer | |

to share the VM to other users the idea is simply to create a new virtual machine on every user login and give it a different name. so When you get to the part about a new or existing hard drive select the existing VM from my login and finished the new set-up. This causes a new .xml file to be created in ~/.VirtualBox/Machines/YourVMname folder. This .xml file holds the config settings for the VM you are running.

REF: http://ubuntuforums.org/showthread.php?t=798011

| improve this answer | |
  • 1
    Not a good idea for multiple users to boot the VM at the same time. – Panther Apr 25 '14 at 20:16
  • the question said to share the VM on the same computer . this will enable him to run it on all the user accounts but not in the same time . after the first user open it if some one tried to open the VM he wont be able to get the lock on the VDI file so they will get an error . but if they opened it in diffrent times it will be ok – Fat Mind Apr 25 '14 at 20:38

You mean that you want to be able to run the VM from more users? It must be easy. Find the directory of the VM. Open VirtualBox on every user account and add VM with the existing virtual drive. (/home/(Username of the person who created the vm)/Virtualbox\ VMs)

| improve this answer | |
  • Not a good idea for multiple users to boot the VM at the same time. – Panther Apr 25 '14 at 20:16
  • not at the same time. i mean he wishes to add it for multiple VirtualBoxes not at once. – aastefanov Apr 25 '14 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.