Forwarding X11 sessions from remote machines using SSH and Xming

less than 1 minute read

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:

  1. Install Xming
  2. 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
  3. 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’.
  4. SSH into a machine
  5. On the remote machine, set the DISPLAY variable to :0.0 `export DISPLAY=10.166.10.10:0.0`
  6. Just to confirm everything is working, run xclock and a clock should show up on the local machine.

Xclock

Every time something is displayed on the graphical environment of the remote machine, it will automatically pop up on the local machine.

Leave a Comment