I have Ubuntu server 14.04 on which i want to run applications with GUI. I have Xauth installed and i have edited the files ssh_config and sshd_config to allow X11 forwarding. On my PC I have Windows 7 OS and I am using Cygwin to connect to the server. I am using this command to connect: ssh -X -i private-key.pem ubuntu@xx.xx.xx.xx

But when I try to run some application with GUI, for example Leafpad, I get error: leafpad: Cannot open display

Also, if I run the command xrandr I get the same error: Can't open display

Any idea why I am getting these error messages?

  • 1
    Windows does not have an X11 server by default. Have you installed one? – Rmano Apr 19 '15 at 8:07
  • I have it installed on Cygwin. – user1800997 Apr 19 '15 at 9:54
  • Does running xhost + on cygwin help? – terdon Apr 19 '15 at 11:21
  • If i run xhost + i get this: xhost: unable to open display "" – user1800997 Apr 19 '15 at 11:52
  • At this point I suspect it's more a windows/cygwin problem than an Ubuntu one. Try asking on superuser.sx – Rmano Apr 19 '15 at 13:50

With your server properly configured, and with X11 server installed on your Windows.

You might need to run export DISPLAY=YOUR_IP:0 on it after connected to the server. The "YOUR_IP" should be change into the IP address of your Windows.

Or, you can try to run startxwin in you Cygwin shell before connect to the server, which will brings up a xterm window for graphical stuff. It will complete the DIPSLAY setting for you automatically, and you should be able to run graphical applications.

You can test the result with xlogo command.


| improve this answer | |
  • I installed x11 server on Cygwin and i started the server with the command startxwin but when i try to open gui app like leafpad i get this message: Invalid MIT-MAGIC-COOKIE-1 keyleafpad: Cannot open display: Also if i run xlogo command i get this error: Error: Can't open display: xx.xx.xx.xx:0 xx.xx.xx.xx is my external IP address. – user1800997 Apr 19 '15 at 9:53
  • Do you have your server with "X11Forwarding" set to yes in your /etc/ssh/sshd_config file? – P.-H. Lin Apr 21 '15 at 3:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.