Sunday, February 10, 2008

SSH Tunneling Example (X Forwarding)


Machine A is a machine with an active X-Window server and the necessary SSH client software. Machine B is a Linux machine with SSHD running that we have root access to. Machine C is also a Linux machine that we have an account on. From A, we are going to create an SSH tunnel through B which accesses C and displays X-Window client applications back on A via the tunnel. Do something like this:

ssh -X -l root -L 22:<C_IP_ADDRESS>:22 -N <B_IP_ADDRESS>

-- Supply the root password for B when prompted.
-- Supply the correct login/password for C when prompted.
-- Port 22 is the default port for SSH.
-- Execute an X-Window client application on C to test. Maybe "xeyes" or "xclock".
-- If there are problems, open up the privileges for the X-Window server on A with an "xhost +"