Use VirtualBox over VNC

1 minute read

While for regular use one might setup a headless VM with RDP and/or SSH running on the VM itself, this procedure is for the simplest case where you need something from your remote PC that’s only on the VM.

Prereq

  • Remote: VirtualBox install of guest operating system
  • local: apt install xfreerdp2-x11

on your local laptop, create a script vmrdp.sh containing:

#!/bin/bash

set -e

ssh -f -L 5930:localhost:5930 [email protected] sleep 1;

xfreerdp /u:VMusername /v:localhost:5930

You can add a few simple FreeRDP options to enhance performance, especially on limited data bandwidth connections

GUI

Most people can get by with this, and don’t need the alternative command line option.

  1. establish a VNC connection over SSH
  2. if you use the very basic OpenBox desktop environment, open a Terminal on the remote PC by right clicking anywhere on the remote desktop and type
    virtualbox
    

    the usual VirtualBox program should open

  3. from the right dropdown menu of the right arrow “start” button on the main VirtualBox window on the remote VNC PC, click headless. The status of the VM will show “Running”.
  4. connect from your laptop with a script vmrdp.sh as above.
  5. when done, shutdown your VM as usual if desired.

Command line

Most can use the GUI method above, but VirtualBox can also be managed well via shell commands.

virtualbox vmstart MyVMName --headless

starts up the VM named “MyVMName” for example.

Numerous headless options exist for low server resource utilization via VBoxManage CLI.

Leave a comment