I need some help. I am trying to use ssh -X to connect to a remote server that has enabled X11 forwarding.

When I use my MacBook to connect to the remote server, I use ssh -X USERNAME@SERVER and then if for example I type matlab, it opens the XQuartz application on my MacBook and then the GUI of matlab opens. Perfect until here.

I now want to do the same but from a Windows machine. I first start the Xming program. I can see it at the bottom right corner running (I see Xming Serve:0.0). When I repeat the above process, the matlab GUI does not open.

I also tried to connect using ssh -v -X and after inserting my password I see this message among a lot:

debug1: X11 forwarding requested but DISPLAY not set

I tried to run (on my local terminal before ssh attempt): SET DISPLAY=localhost:0.0 and then echo %DISPLAY% returns localhost:0.0 but still ssh -X still does not open GUIs.

What is localhost and where can I find it? Any help?


Managed to solve this after being inspired by the comments.

Step 1: I right-clicked xming and opened its log. In there, I found an IP for the DISPLAY.

Step 2: export does not exist on Windows so I used SET DISPLAY=IP:0.0

Step 3: ssh -X failed again but ssh -Y worked!!!

  • I can only speak to the last thing you tried and tell you how >I< do it. Setting the display on your local terminal in windows is pointless. You are setting the variable on the REMOTE HOST, not windows. I believe that ssh -X does just that (but never used it via windows). SSH into the remote. export your display using the IP of the windows box. let 'er rip.. as in xterm & (or whatever). Also, I think VcXsrv is better than Xming. Get simple ssh THEN forwarding to work.. then jump into the ssh -X command. Feb 22 at 16:02
  • export your display using the IP of the windows box.. as in log into your remote via ssh.. then export DISPLAY=<windows_ip_here>:0.0. If you get that working, you will at least know the mechanism is working. Feb 22 at 16:04
  • Thanks both. I managed to solve the problem. I edited my post.
    – seralouk
    Feb 22 at 16:13
  • "export does not exist on Windows so I used SET DISPLAY=IP:0.0". This did nothing. You set the display on the machine PROVIDING x11, not the client. It worked because your ssh command setup the remote environment for you. And I am glad that you got it working :) Feb 22 at 16:58
  • Hi. If I do not do this then the GUI does not work. So, no idea why but if I use SET before my ssh, GUIs work.
    – seralouk
    Feb 23 at 7:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.