Sending X-Window displays through a VPN to a VMWare Linux Client

This took me a few hours to figure out ... hopefully this will save you those hours.

I work remotely and recently had to connect to a Linux server in head-office via a VPN. My VPN client machine is 32bit windows7 ... with no X-Windows software installed.

Step 1 was to install VMWare Player and then create a Linux VM. I chose Oracle Enterprise Linux because I needed an Oracle server anyways. I'm skipping the instructions on how to install this ... it's all on Oracles website and there were no issues.

Initial Configuration:
Laptop with Win7 (32bit) VPN'd to a corporate network. Laptop is running VMWare Player 4.0.x which is hosting Oracle Enterprise Linux 6.

I tried SSH from the VM on my laptop to the remote server but could not export the display back to my laptop because the remote server did not have X11Forwarding set ... so I'd need to open another channel/tunnel for that.

I needed to confirm that the X Server on my laptops VM would accept connections on port 6000 ... it didn't. You can check by:
user@local:~$ telnet 6000
If you get an error then the X-Server is not listening.
If you get:
Connected to Escape char is '^]'
then your X-Server is already listening to port 6000
The X-Server in my VM was not listening so I needed to add:
under the [security] line of /etc/gdm/custom.conf
and then save the file and reboot the VM.

When the VM was rebooted I opened a shell and executed:
user@local:~$ xauth list
local/unix:0 MIT-MAGIC-COOKIE-1 8a852850d10bdaa2e6573960cf02f9cf

What we need from this is the string beginning 8a85... this is what X-Clients use to authenticate themselves to the X-Server.

Next thing to do was connect to the remote server and forward port 6001 back to our VM:
user@local:~$ ssh -x -R 6001: user@remote
This command will forward port 6001 from remote to port 6000 on our local machine.

We need to add the authorization info to the remote machine:
remote$ xauth add :1 . <8a85... whatever xauth list gave you>
This adds a new X display, :1, to the remote machine.

Now we need to set the display on the remote machine:
remote$ export DISPLAY=

You can now run X commands on the remote machine and they will appear in the VM on your local machine. Try it:
remote$ xterm
Should open an xterm in the VM on your local machine.

Good Luck!