See here
Install putty, and then enter your virtual machine's IP,
then go to Connection->ssh->X11, click Enable X11 forwarding and give the Xauthority file C:\Cygwin64\C:\cygwin64\home\${YOUR_USERNAME_HERE}\.Xauthority
.
Save the session with your favorite name to reuse the session.
Now, start the session and enter your passwd. Try launching any GUI program.
You can now open a ssh connection to the vm machine via another ssh session or another ssh tool, like terminus, which is much more beautiful than putty.
First, in that putty session, type echo $DISPLAY
and enter. COPY THE OUTPUT.
Then, in the new ssh session, type export $DISPLAY=${WHAT_YOU_JUST_COPIED}
and enter.
Try to launch a GUI program in that session, you will find that as long as you keep that putty session open, you can launch any GUI program in the new session, too, as long as you repeat the process above every time.
Add the following line to ~/.bashrc
so that you can always open GUI program in another ssh session as long as the putty session is open:
# Automatically save and load DISPLAY
# NOTE: This script will record the last session that has environment variable `DISPLAY` set.
if [ -z "$DISPLAY" ]; then
export DISPLAY=`cat ~/.XDISPLAY.var`
else
echo $DISPLAY > .XDISPLAY.var
fi
Since x-server on the vm is not required for this unity mode to work, it is safe to disable it at from auto starting. See here.
If you are using vmware pro 15, then you can close the vmware window without also closing the virtual machine.