Linux – How to forward X through two SSH tunnels

arch linuxopenbsdsshtunnelxorg

I'm trying to run an X program on my home computer from my work computer. The basic setup is this:

Arch Linux work computer -> OpenBSD SSH router(at home) -> Arch Linux home computer(with SSH)

I've never actually tried to do this and I'm not quite sure how to. How would I get this to work?

When I just try doing

$(work computer) ssh -Y home-ip
..
$(home router) ssh -Y private-ip

I get on the last tunnel "X11 forwarding request failed on channel 0"

How do I do this properly?

EDIT: I forgot to enable X forwarding on the sshd of my home computer. I've fixed that now, but nothing seems to happen when I do a simple command like xterm. It just sits there, presumably trying to display the xterm window on my router and not on my work computer

Best Answer

How about forwarding a port on your work computer to your home computer's port 22 and then ssh -Y to that local port?

For example,

ssh -L 2222:private-ip:22 router-ip
ssh -Y localhost:2222
Related Question