I have 2 Linux Boxes (S1 - and C1 - and a Windows 7 Box (W1 -

One of the Linux machines (S1) was setup with SSH and X forwarding, and the windows box (W1) has Xming server on 0.0.

I can run Putty, then xeyes on the windows box(W1) and it displays fine.

On the second linux box C1), I cannot get remote x running over ssh.

I can log in from C1 to S1 via ssh -X but when I run a graphical program, it doesn't display on the remote machine, it just sits there until a "Can't open display:" comes up.

What am I doing wrong?


Your error message "Can't open display:" doesn't sound like SSH X11 forwarding is in use. Instead, programs on the remote host are trying to connect directly to C1, which won't work for quite a few reasons (Xorg does not listen for TCP connections by default; your firewall blocks them; the Xauth data was not sent correctly...) If X11 forwarding was in effect, then $DISPLAY would point back at the same machine (localhost), and the display number would start at :10.

First, check the $DISPLAY value on C1, and make sure clients on C1 can connect to the X server.

Then retry the connection C1→S1 using ssh -X -v -v S1 and make sure there are no error messages regarding X11 forwarding; it might be disabled on the server. (If you connect with PuTTY, then Ctrl+rightclick the console and select "Event Log".)

To see the server logs, add LogLevel DEBUG2 to /etc/ssh/sshd_config and restart sshd.

  • OK, maybe I'm getting confused then. I thought my W1 and S1 were doing SSH X11 forwarding, but by the sounds of it, Xming on W1 is simply listening for TCP connections and the DISPLAY variable just happens to be setup correctly to use it. Should I set DISPLAY on S1 to be localhost:10.0 when ssh login is achieved by C1 and W1? – wkdmarty Aug 28 '14 at 7:55
  • I've done that but it now comes up with "X11 connection rejected because of wrong authentication" "Error: Can't open display: localhost:10.0" – wkdmarty Aug 28 '14 at 7:59
  • @wkdmarty: If X11 forwarding worked, then $DISPLAY would be configured automatically... Have you checked the client & server logs? – grawity Aug 28 '14 at 8:02
  • OK, if I SSH into S1 from C1, DISPLAY is localhost:10.0 . Is this error now an xauth problem? I have set XAUTHORITY to /home/marty/.Xauthority but that's local to S1. This is where I get confused. Should xauth list on S1 include localhost/unix:10 MIT-MAGIC-COOKIE-1 and the hexhey of C1? Currently it just has it's machine name and it's own hexkey. – wkdmarty Aug 28 '14 at 8:49
  • Interestingly (and annoyingly) if I PuTTY in from W1 or C1, DISPLAY is blank. – wkdmarty Aug 28 '14 at 8:53

Most likely - In the putty config for C1, did you check "Enable X Forwarding" (under Connection->SSH->X11).

Also, is the DISPLAY environmental variable set on C1?

  • On both clients, yes. DISPLAY on C1 is (it's current IP) – wkdmarty Aug 28 '14 at 7:52

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.