Use VirtualBox over VNC
While for regular use one might setup a headless VM with RDP and/or SSH running on the VM itself, this procedure is for connecting to a virtual machine on a remote PC.
Prerequisites:
- Remote: VirtualBox install of guest operating system
- local:
apt install xfreerdp-x11
on your local laptop, create a script vmrdp.sh
containing:
#!/usr/bin/env bash
set -o errexit
ssh -f -L 5930:localhost:5930 sshusername@1.2.3.4 sleep 1;
xfreerdp /u:VMusername /v:localhost:5930
Optionally, add a few simple FreeRDP options to enhance performance, especially on limited data bandwidth connections
Most people can use the VirtualBox GUI, and don’t need the alternative command line option. Establish a VNC connection over SSH The very basic OpenBox desktop environment can open a Terminal on the remote PC by right clicking anywhere on the remote desktop and type
virtualbox
The usual VirtualBox program should open
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”.
Connect from laptop with a script vmrdp.sh
as above.
When done, shutdown your VM as usual if desired.
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.