When working on remote Linux machines using SSH, there is usually no need to access the graphical environment but sometimes it can be very useful. When recently trying to play around with MATLAB on a remote Linux machine I had no physical access to, I saved a lot of time after discovering this method.
Here’s what to do:
- Install Xming
- Run XLaunch then select Multiple windows -> Start no client -> No Access Control -> Finish. Or equivalently you could just run this from the command line-
"C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow -ac
- Right click XMing in the Notification Area Icons -> ‘View Log’ and note down the IP address in the ‘XdmcpRegisterConnection’ line. Find ‘DISPLAY’ in the file and it should likely be ‘DISPLAY=127.0.0.1:0.0’.
- SSH into a machine
- On the remote machine, set the DISPLAY variable to
:0.0 `export DISPLAY=10.166.10.10:0.0`
- Just to confirm everything is working, run
xclockand a clock should show up on the local machine.
Every time something is displayed on the graphical environment of the remote machine, it will automatically pop up on the local machine.