Linux – Forwarding X11 between Windows > Linux Server1 > Linux server2

forwardinglinuxx11

I got this problem…

My machine is a Windows(S1), who needs to connect to a Linux Server(S2) [used like a jumpbox], to connect with Linux Server(S3), which is the target machine.

I got Putty and Xming well configured, since I can open Firefox browser on S2; but when I connect to the S3 via SSH I can't open any X app there. I installed the xclock so I can test it, and I got this message:

Error: Can't open display

My proceedure is: Windows >putty> LinuxS2 >SSH> LinuxS3.
Can open X apps on Linux S2, but not on Linux S3.

The networks between Windows and Linux S3 are differente, that's why the Linux S2 exists.

Best Answer

In your Putty session:

1) you need to enable Connection => SSH => X11 Forwarding

2) invoke ssh to S3 with -X option in Connection => SSH => Remote Command , for example : ssh -X user@S3

In S2 and S3, the /etc/ssh/sshd_config need to have X11Forwarding set to yes. (restart sshd when changing this).

The DISPLAY should be set to a value starting from value of X11DisplayOffset in sshd_config of S3.

And hopefully, this should make it work.