Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if it's possible to run an Ubuntu virtual machine using VirtualBox in background, I mean, without any window open.

The idea is to connect via SSH to the Linux host, that would be running in background.

Has anyone ever done something like this? Is it possible?

share|improve this question
You mean connect via SSH to the linux guest? You can do this very easily with QEMU which will actually run the guest in your terminal. – Felix Apr 28 '10 at 12:13
So you also may be interested in the SSH configuration: – Fabricio PH May 23 '14 at 20:20
possible duplicate of How can I start a VM without getting a window? – Randall Flagg Sep 10 '14 at 12:01
Leaving open as this question is better treated as the original; voted to close as duplicate on the other question. – bwDraco Apr 15 '15 at 23:43
Completely agree with @DragonLord - click here to go to the other question and close it as a dupe to this one. – Raystafarian Apr 19 '15 at 9:33

VBoxManage startvm $VM --type headless will start the specified virtual machine in the background.

To shut it down, request the shut down from the guest.

share|improve this answer
You will only be able to SSH into the machine if you've setup networking properly. I think you need to use bridged so that the VM and your machine are on the same network. Also, VirtualBox will still run the gui of the target OS and you can connect to it via remote desktop, "rdesktop" (get from apt since you're in ubuntu) – basszero Apr 28 '10 at 11:36
True. I assume that the VM is run usually through the VirtualBox GUI first to get it installed and configured. Only use VBoxManage once everything (including networking) works. – developmentalinsanity Apr 28 '10 at 11:48
With other VM software, I can close the window so it isn't always open and have it continue to run in the background, but open the window when I want to interface with it. Is this what this does? – JFA Jul 1 '15 at 13:13
Make sure to ssh to the machine without -X or -Y since those seem to make the above command attach the process to the shell, so if you exit, the VM aborts. – moritz Aug 28 '15 at 9:06

This is built into VirtualBox 4.2.

Simply hold down Shift when launching the VM from the Manager.

share|improve this answer
Brilliant, thanks! :) – Chiramisu May 16 '15 at 18:19

Absolutely! You are looking for a headless installation (Virtualbox). The way to start the machine from the command line is something like:

VBoxHeadless --startvm Debian --vrdp=off

However you will need some way to connect. What I do is mapping ports between guest and host. With this configuration, your host 2222 port will be mapped to port 22 of your guest machine.

VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP  
VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22  
VBoxManage setextradata "Debian" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222  

After that you can log in with:

ssh localhost -p2222
share|improve this answer

I don't think seamless mode is quite what he's looking for here, I think the proper thing would be VBoxHeadless which details of you can find in the manual. It runs using a command-lin interface and would be used, for example, if a virtual machine was running on a server but the display was not wanted from the server. You will be able to remote desktop onto the machine (providing you know how to set the option via command line).

I would reccomend asking this in the virtualbox forums. Actually, do a search first as I expect this has already been asked.

VBoxManage was the right thing, sorry. Link the info in the manual

share|improve this answer

I'm using VBoxTool from and it works perfectly for me. It can autostart VMs at boot and stop/save VMs at shutdown and provides a simple clean command line interface.

share|improve this answer

an alternative to VBoxManage startvm "{VMName}" --type headless is
VBoxHeadless -startvm "{VMName}"

Amusingly enough, I just finished figuring out how to run a VM headless, over RDP.

Note - At least on windows, it will block your command window. If you need to continue using your console window, open another to start the VM in.

To shut the VM down, you request the Guest OS to shutdown. VBoxHeadless releases the console when the Guest is fully shut down (You can Ctrl+C, but I think it may be analogus to a hard reset on a real machine).

share|improve this answer
The fact that vboxheadless blocks the console very much defeats the purpose of a headless mode. On Mac OS X (and presumably on Linux and Solaris) the headless mode works when you send vboxheadless into the background using &. – Andrew J. Brehm Apr 28 '10 at 11:48
I'd imagine there is a way to do that on windows, I just haven't found it. In any event, a headless vm certainly uses less resources on the server computer than one running a full GUI. – Fake Name Apr 28 '10 at 12:20

I found that the headless mode seems to work fine when backgrounding in Linux (CentOS 5.6), but you lose access to the RDP functionality as long as the process is backgrounded. Do an 'fg' to bring the process back to the foreground, and RDP functionality is restored. Looks like starting the vm headless is best accomplished through an init script, where interactivity with the console is not required.

share|improve this answer

I've added these lines into my .bashrc:

alias vm='VBoxManage startvm $VM --type headless'
alias sshvm='ssh -p2222 localhost'

For ssh access you don't need to change the configuration just keep the NAT and you can set up port forwarding table as following:

Name      | Protocol | Host Port | Guest Port
guestssh  | TCP      | 2222      | 22
localhost | TCP      | 8080      | 80

When you insert localhost:8080 into your machine browser the page from VM (on port 80) will be opened.

share|improve this answer

You can use VBoxHeadless or (and I wonder why nobody mentioned this before me) you can simply select one of start-up options, which will run the VM without any GUI.

Either hold shift and start the machine, or right click the machine and search for something like "Run without output" under item "Run"

share|improve this answer

You must log in to answer this question.