Pages Menu
Categories Menu

Posted by on Oct 28, 2012 in Linux | 0 comments

Tunnelling a Headless VM Through an SSH Tunnel

I was doing a web project for a client recently where I needed to administer a server VM but only had access to the machine via port 22 (SSH).

I setup the machine to run as a Headless VM but, because of the security restrictions, I needed to configure  an encrypted tunnel created through an SSH connection. For more information on setting up a headless VM for VRDP, see my previous post Running a Headless VM over VRDP.

This describes how to configure an SSH tunnel using Cygwin using a Windows machine. You could also use putty to create the tunnel.

# First you need to ensure that your Virtual Machine has VRDP enabled.
VBoxManage modifyvm "VM name" --vrde on

# Specify a port for the VRDP service. Here, I have chosen port 10000.
VBoxManage modifyvm "VM name" --vrdeport 10000

# Start VM on Server Host (from ssh prompt)
VBoxManage startvm "VM name" --type headless

# From a Cygwin prompt on your machine, create an SSH tunnel
ssh -L 10000:localhost:10000

# From cmd prompt on your local windows machine
mstsc /v:localhost:10000