Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a WinXP virtual machine under Ubuntu and every user on this Ubuntu should have permission to run this VM. But every time someone runs this VM, the file permissions are set 400 and 600 (accordingly .VirtualBox/VirtualBox.xml and .VirtualBox/Machines/win/win.xml) and ownership is set to the last user. Then i change them back to 444 and 666, so any user could access VM, but I'm looking for permanent solution.

Background: users belong to vboxusers group, Ubuntu 8.04, Virtualbox 4.0.16

EDIT: based on answers so far, i must explain: we need this XP VM only about 5-10 minutes a day, so running it whole time and just connecting to it is not very good solution in our workflow.

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted
+50

Access mode (permissions) can be changed by file owner and by root, right? Thus chown root on the files are supposed to lock out everyone but root from mangling with access modes - unless the files are recreated every time, which needs write access to the containing directory, which is not as safe to take away but worths a try.

Hope this helps.

share|improve this answer
    
Yes, thank you, it worked. I thought, i tried it already, but seems i did not. –  wk. May 2 '12 at 6:54
    
+1 for working solution, but methinks you might be unable to modify vms, disks etc now? –  dwurf May 2 '12 at 13:45
    
@dwurf chmod 666 (or 664 and the right group) on the files to allow modification while locking them out from breaking mode bits –  yarek May 2 '12 at 17:02
add comment

Edit the sudoers file

sudo visudo

Add a line to sudoers like the following:

# Give all members of the vmwin group permission to start the vm 
# called 'win' as the user 'vmuser'
%vmwin ALL = (vmuser) /usr/bin/vboxmanage startvm win

Add users to the group vmwin as appropriate.

Your users can start the vm with a line like this:

HOME=/home/vmuser sudo -u vmuser vboxmanage startvm win
share|improve this answer
    
I like the answer, but i did not get it work. Mangled with permissions more, but still i got error:Waiting for the VM to power on... VBoxManage: error: The virtual machine 'win' has terminated unexpectedly during startup with exit code 0 VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Machine, interface IMachine, callee When i log in as vmuser i got VM to work, but not with sudo while logged in as some other user –  wk. Apr 30 '12 at 21:07
    
Googling for that error message suggests a problem accessing the VM's xml configuration file, take a look at that. I tested this solution before posting, I know it's possible to make it work! –  dwurf Apr 30 '12 at 21:55
    
Huh, i moved whole .VirtualBox-dir to /home/vmuser, i chown -R vmuser.vmwin /home/vmuser after that. VM-machine's directory is set to 777, win.xml to 666. Log in as vmuser and i got VM work fine, but when try with sudo as you suggested, fails still with same error as above.... –  wk. May 2 '12 at 6:47
add comment

Why you don't enable VNC or Terminal Services on the VM and let users connect 'remotely' to it? Your question is not clear about if you want people to use the machine in turns or just all at the same time.

share|improve this answer
    
You mean like running VM headless whole time? We need this XP machine for 5-10 minutes in day, so it fits better to our workflow to start it just if needed. And then it is clear: start machine, do the job, close machine. And according the question: only the one who sits behind the computer should have access to the VM, no other/remote users same time. And, yes VNC or something may be still a solution, i have no background with them, but it is worth to think about it. –  wk. Mar 28 '12 at 14:58
    
By rebooting VMs all the time you might use more resources than letting them up all the time. –  Mircea Vutcovici May 2 '12 at 1:30
add comment

Why not use the vboxweb project to get all of the VirtualBox GUI's functionality available from a web interface? For direct access to VM's you should consider VNC to the VM console or a native platform method.

share|improve this answer
    
More than accessing the VM, my problem concerns starting it by different users. I have no need to run it whole time. –  wk. Apr 25 '12 at 9:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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