I have a centos server with barebones X11 installed. I am trying to connect to this server from my Windows box with Putty and Xming.

I have set X11Forwarding to yes in the sshd_config file. I have install x11 apps and xauth. I connect to the server with Putty with X11 forwarding enabled and pointing to localhost:0 and I have the Xming server running.

Trying to run xclock, I always get "Error: Can't open display". Any ideas what I can check or what I am missing. I have been googling since 2h already!

P.S. I am not running an X server on the server side. I am not sure I can do this with a VPS.


localhost:0 is almost certainly wrong. sshd starts at :10, and sets $DISPLAY for you already.

  • X11DisplayOffset 10 should be set in sshd_config? – sam yi Sep 19 '16 at 20:03
  • @samyi: That is the default value. – Ignacio Vazquez-Abrams Sep 19 '16 at 20:11

xclock seems buggy with new Putty & Xming versions.

I suggest you try some other command like xlogo, xterm or xev to test (wait at least 5s) .

If it's still not working, check the $DISPLAY env variable on the server (CentOS):



env | grep DISPLAY

UPDATE: here's a step-by-step guide:


Hope this helps.

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.