0

I have 2 Linux Boxes (S1 - 192.168.0.98 and C1 - 192.168.0.76) and a Windows 7 Box (W1 - 192.168.0.91).

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: 192.168.0.76:0.0" comes up.

What am I doing wrong?

wkdmarty
  • 895
  • 2
  • 9
  • 12

2 Answers2

1

Your error message "Can't open display: 192.168.0.76:0.0" 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.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • 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 07: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 07:59
  • @wkdmarty: If X11 forwarding worked, then $DISPLAY would be configured automatically... Have you checked the client & server logs? – u1686_grawity Aug 28 '14 at 08: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 08:49
  • Interestingly (and annoyingly) if I PuTTY in from W1 or C1, DISPLAY is blank. – wkdmarty Aug 28 '14 at 08:53
  • @wkdmarty: Yes, the forwarding function will add `localhost/unix:10` on S1, though I _think_ it might generate a different key. **Check the client & server logs.** – u1686_grawity Aug 28 '14 at 09:24
  • Checked S1 "xauth list" - Only 1 entry and that's for that machine, no localhost/unix:10's or similar. Which logs should I be checking? in /var/log I have a load, but the only one that looks related to this is Xorg.0.log - nothing useful in there (I don't think). Sorry to be a newbie on this, I thought I was getting better at my Linux (hence these linux boxes) – wkdmarty Aug 28 '14 at 09:33
  • Even if I manually add "xauth add localhost/unix:10 MIT-MAGIC-COOKIE-1 {C1HEXKEY}" it still gives an error of "X11 connection rejected because of wrong authentication". – wkdmarty Aug 28 '14 at 09:35
  • @wkdmarty: See the last paragraph of the post for client-side logs. (I'll update for the server-side ones.) – u1686_grawity Aug 28 '14 at 09:35
  • EventLog of PuTTY - X11 Forwarding enabled. Then on running xeyes - Received X11 connect request from ::1:42852. Opening X11 forward connection succeeded. Nothing left to send, closing channel. Forwarded X11 connection terminated. – wkdmarty Aug 28 '14 at 09:44
  • Slight change now I've restarted sshd. EventLog of PuTTY - X11 Forwarding enabled. Then on running xeyes - Received X11 connect request from 127.0.0.1:60923. Opening X11 forward connection succeeded. Nothing left to send, closing channel. Forwarded X11 connection terminated. – wkdmarty Aug 28 '14 at 09:50
  • OK, I've closed this question because I think forwarding was not in use, and I had simply opened a firewall port on my Windows box to allow direct TCP to my Xming server. I now however, still have a problem using forwarding. It doesn't work and errors with wrong authentication. Please see http://superuser.com/questions/805725/how-do-i-debug-x11-connection-rejected-because-of-wrong-authentication – wkdmarty Sep 01 '14 at 14:00
0

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?

jdh
  • 7,023
  • 17
  • 22