How to enable SSH X11 forwarding through additional server?
Solution 1:
There are several ways to do this, the one I prefer is to forward the ssh port:
First, connect to machine B and forward [localPort] to C:22 through B
A$ ssh -L [localPort]:C:22 B
Next, connect to C from A through this newly-created tunnel using [localPort], forwarding X11
A$ ssh -X -p [localPort] localhost
Now we can run X11 programs on C and have them display on A
C$ xclock
[localPort] can be any port that you are not already listening to on A, I often use 2222 for simplicity.
Solution 2:
This can easily be accomplished using port forwarding:
A$ ssh -NL 2022:C:22 B &
A$ ssh -X -p 2022 localhost
C$ xclock
Port localhost:2022 is forwarded to C:22 via B SSH to C via localhost:2022 Use X as normal
Solution 3:
Have you tried with
A$ ssh -Y B
B$ ssh -Y C
C$ xlclock
The -Y flag "Enables trusted X11 forwarding."
Solution 4:
Assuming the problem is that the middle machine doesn't have X, but it otherwise configured to allow forwarding X11, just install xauth.
on a yum-based system (fedora, redhat, centos):
B$ sudo yum install xauth
on an apt-based system (debian, ubuntu):
B$ sudo apt-get install xauth
Solution 5:
For newer versions opensshd you have to disable X11UseLocalhost
for this to work.
You need to do this on Host C's /etc/ssh/sshd_config
and restart sshd for this to work:
X11Forwarding yes
X11UseLocalhost no