VBoxHeadless - Running Virtual Machines With VirtualBox 2.0 On A Headless Ubuntu 8.04 Server - Page 2

4 Connecting To A VM From A Remote Desktop

4.1 Windows XP

You can use the built-in Remote Desktop Connection utility to connect to the VM:

Type in the hostname or IP address of the host (not the guest!):

And voilà, you should be connected to the VM:


4.2 Linux

On Linux desktops, you can use the rdesktop command to connect to the VM. Open a terminal (on Ubuntu, for example, it's under Applications > Accessories > Terminal)...

... and type in the following command:

rdesktop -a 16

( is the host IP address, not the one of the guest - replace it with your own IP address or hostname; -a 16 means 16 Mio. colours.)

And voilà, you should be connected to the VM:


5 Links

Share this page:

21 Comment(s)

Add comment


From: Anonymous at: 2009-04-10 02:44:05

How can I start VMs without logging in during bootup?

How could I write an init script to do this?




From: Richard Gomes at: 2009-06-04 12:02:22

Insert these lines in your /etc/rc.local :

for vm in `ls /root/.VirtualBox/Machines` ;do
  VBoxManage startvm $vm -type vrdp

Obs: I have a .VirtualBox under my /root. See what applies to your environment.

Hope it helps

Richard Gomes

From: Richard Gomes at: 2009-06-04 12:09:21

Insert these lines in your /etc/rc.local :

for vm in `ls /root/.VirtualBox/Machines` ;do
  VBoxManage startvm $vm -type vrdp

Obs: I have a .VirtualBox under my /root. See what applies to your environment.

Hope it helps

Richard Gomes

From: Brian at: 2008-10-01 20:51:08


having tryed a few different ways, of starting a virtual machine from remote and then exiting the rsh connection to the remote host. the method below is the one that works for me in solaris.

VBoxManage startvm <session name> -type vrdp


From: Opieum at: 2008-09-25 04:45:35


What you described could just as easily apply to VMware as well. VMware may not be FOSS but it is at least free in price.  And TBH I find it to be more rock solid in terms of quality with more robust Virtual hardware support. The new web interface can give you a very good opportunity at creating and managing VMs. Or you could use Vmware 1.0 and install the client portion on a remote machine to manage the server. Both products are free. Or if you have compatibile hardware install ESXi which would be the best option if you are going to run headless.  


From: a non-emouse at: 2008-09-25 11:42:31

to do the same thing, you could run

screen  VBoxHeadless -startvm dev1

 then hit control A then D

 and it will run happily in the background, and even log out from the desktop or terminal session.

 screen -dr will happily bring it back to the foreground when you want it, even from a remote session.

From: Joseph Moreland at: 2008-09-25 15:59:21

How about 

nohup VBoxHeadless -startvm dev1 &

 then logout without worry.


From: Shane watson at: 2008-12-02 09:56:01

i  have  found this  article http://www.virtualizationteam.com/microsoft/hyper-v/important-information-about-hyper-v.html

about insatling VMWare on window platform. its sounds goods working on window i think linux would be the better platform.

From: markba at: 2008-09-25 20:54:28

The VBoxHeadless command can also be issued like this:
VBoxManage startvm <session name> -type vrdp

It works flawlessly, it is not necessary to add a '&' after the command to regain console control.

For easy control of controlling VirtualBox sessions in a headless Linux environment, I'm currently developing a management framework: VBoxTool. As of now, it consist a script with which you can mass start, save, backup and configure (vrdp port) vbox sessions.

From: Sean Stoops at: 2008-09-24 05:37:42

I use this everyday, thought I usually append an ampersand on the end so kick it into the background.

 VBoxHeadless -startvm dev1 &

Just make sure you don't go closing that terminal session or else your VM will go down with it.

From: Daniel at: 2008-10-01 01:43:51

Excellent article! Is it possible to run VirtualBox as described in this article but access desktop VMs on the same machine instead of remotely? Servers I can see, but how would one invoke a VM running, say, Xubuntu? I want to have a good base server OS that never gets modified, and on top of it run a network of VMs (graphical and otherwise) to do my web development.

From: marmellat at: 2009-05-31 08:57:20

it works perfectly on my debian lenny , thanks

From: 2iR0n at: 2009-06-16 23:09:20

# For vms installed by a normal user (not root) this works on a Ubuntu 9.04 host machine.

for vm in `ls /home/USER/.VirtualBox/Machines`


/bin/su -l USER -c "nohup /usr/bin/VBoxManage startvm $vm --type vrdp"


# If more than one vm is to be started you will need to set different ports for vrdp to work. Eg...

VBoxManage modifyvm VMNAME --vrdpport 3390

rdesktop xxx.xxx.xxx.xxx:3390

# for Windows TS client you have to edit the freakin' registry... LOL


From: Anonymous at: 2011-03-16 15:48:14

Thanks for this script.  Suitably modified, it was exactly what I was looking for.

From: Limey at: 2009-08-27 18:09:23

This is exactly what I'm trying to do, but won't...

sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-2.0

...install all the dependencies of Virtual Box as well, i.e. all the X (GUI) stuff which you don't want on the server?

From: Anonymous at: 2009-09-10 12:47:19

Dont forget to set your bridge Interface:

VBoxManage modifyvm "WindowsXP" --nic1 bridged --bridgeadapter1 eth0

From: Anonymous at: 2009-04-29 17:49:51

I have successfully used Ctrl+Alt+End to pass Ctrl+Alt_Delete to RDP instance

From: Emil at: 2008-09-28 17:01:55

Hi, Nice article, though I have a small correction;
The "-a 16" option to rdesktop mean 16 bit color depth, not 16 M colors.

Best regards, Emil

From: J* at: 2008-11-19 16:44:11

Way to go playa, excellent tut!

From: sam at: 2009-03-20 04:05:04

Thank you for this tuto


my guest is a winserver

how do you fire ctrl+alt+del from a rdesktop session ?


From: John L at: 2009-06-27 23:16:41

This had just the info I was looking for to have a VM start up automatically in Ubuntu Desktop (by adding startvm command to Sessions) without interfering with the GUI (but still accessible via RDP).  Glad I looked here first for the answer.