Forward X over SSH through an intermediary host

One of the many useful features of SSH is X forwarding, which allows you to run a program on a remote host and have the GUI for that application display on your workstation as if it were running locally.  But what if you need to run a program on host2, which is only accessible through an intermediary host, host1?

SSH’s ability to forward arbitrary ports to the rescue!

First, log into host1 with X forwarding enabled:

$ ssh -X user@host1

Next, from host1, log into host2 as such:

$ ssh -R 9000:localhost:9000 user@host2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: