Linux – Forwarding X11 with one hop without X-server installed

linuxsshx11x11forwardingxserver

problem

I want to run X-applications remotely on a machine C from my client A. The only way to connect to this machine is by using machine B (firewall) as a hop:

A –> B –> C

So far, simple ssh works as expected, however I can't get X11 forwarding running.

I have found some similar questions, but I think they all assume that X11 is running on B. Solutions like How to enable SSH X11 forwarding through additional server? seem not to be working with my setup.

Could it be that you need to have a X-server running on B to forward X11 from C to B and B to A?

setup

I have set up my ~./ssh/ssh_config on A according to this article: http://sshmenu.sourceforge.net/articles/transparent-mulithop.html

When I try to connect and forward X11 from C by using

$A: ssh -X C

I get connected to C through B, but without X11 forwarding (although enabled on B and C):

$C: echo $DISPLAY

$C: glxgears 
Error: couldn't open display (null)

machines used

  • A: Arch Linux 3.13.7-1-ARCH notebook running X-server/gnome
  • B: Debian 6 Linux 2.6.32-5-amd64 pc no X-server installed/running
  • C: OpenSuse 13.1 3.11.10-7-desktop pc running X-server/gnome

conclusion

I'm not sure if the problem exists because of my configuration/setup or this would not word in general…
I would appreciate if anyone with similar problem/experience could help me out!

Best Answer

I don't believe the X11 forwarding will work in the described multi-hop scenario.

However, if you were to first establish an ssh connection A->B with port forwarding to C:22 and then connect to C with X11 forwarding through the established 'direct' connection that should work just fine.

Something like the following:

A $ ssh -L2200:C:22 -N B (possibly putting that to the background)

followed by:

A $ ssh -X -p2200 localhost