Trying to run virtualboxes as non root.

I have tried to get xboxwebserv to run as regular user. But then when it's started, cannot login to phpvirtualbox and cannot start any virtualbox.

The regular user was put into vboxusers group. /etc/rc.conf has:
Code:
vboxheadless_user="virtuser"
vboxwebsrv_user="virtuser"
When the following command was run as the user wanted to run virtualboxes:

Code:
%VBoxHeadless -s 1stbox -n -v on -e "TCP/Address=x.x.x.x" -e "TCP/Port=5900"

It displays:
Code:
Invalid machine name or UUID!

Once /etc/rc.conf has:
Code:
vboxwebsrv_user="root"
vboxheadless_user="root"
it works, but is running as root.

Any idea's how to get all the virtualboxes and vboxwebserv to run as a regular user?
 
Virtual machines are saved in ~/.VirtualBox/. If they were created as root, they are still in /root/.VirtualBox/. Probably should move them to /home/virtuser/.VirtualBox. The UUID thing... I don't know if you'll have to edit something after moving them and changing owner.
 
Hi,

Try [CMD=]%VBoxHeadless --startvm YourMachineNameHere[/CMD]

Also you can add [CMD=]su -c - your_username VBoxHeadless --startvm YourMachineNameHere[/CMD]to /etc/rc.conf to "fire" the machine on boot.
 
It took a bit of trial and error but I have it working as non root user. In /etc/rc.conf we have:

Code:
vboxheadless_vm1_name="ivorytower"
vboxheadless_vm1_user="vtbox"
vboxheadless_vm2_name="Development"
vboxheadless_vm2_user="vtbox"
vboxheadless_vm2_flags="-n -m 12996 -o funk3"

On a reboot, these VMs don't auto start. But the bottom line of the code above, does allow for using VNC app to get to the box, which is especially useful for doing an install of an OS such as FreeBSD remotely. I just # it out once the OS is installed and ssh -p port_number to the newly created VM.

I wonder if one can have in the 'flags' the extra line Zodias has suggested such as:

Code:
vboxheadless_vm2_flags="-n -m 12996 -o funk3 su -c - your_username --startvm YourMachineNameHere

Perhaps something like:

Code:
vboxheadless_vm2_flags="-s -n -m 12996 -o funk3
is all that is needed. Not sure and I don't want to reboot the Server because its a production Server.

But even as root, one can just run manually
Code:
/usr/local/etc/rc.d/vboxheadless start vm1
and the vm1 will start and
Code:
#ps auxww |grep VBox
will show the VM running as the user listed in /etc/rc.conf shown on the line
Code:
vboxheadless_vm1_user="vtbox"
 
Hi,

Don't know if you got your vm to autostart at boot or not, but I got it working by using the following configuration:

/boot/loader.conf
Code:
vboxdrv_load="YES"

/etc/rc.conf
Code:
# Vbox conf #
vboxnet_enable="YES"  // If you use bridged networking for vm
vboxheadless_enable="YES"
vboxheadless_machines="vm1"
vboxheadless_user="vboxuser"
vboxheadless_vm1_name="actualNameOfVM"
vboxheadless_vm1_user="vboxuser"
vboxheadless_vm1_flags="--vnc --vncport 5900 --vncpass yourpassword"
 
Back
Top