Project

General

Profile

Feature #376

X Forwarding Over Multiple SSH Hops

Added by Daniel Curtis over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
04/23/2014
Due date:
% Done:

100%

Estimated time:
0.50 h
Spent time:

Description

X11 forwarding (AKA X Forwarding) is a slow but manageable way to run a program remotely, accessing a remote systems disk, memory, CPU, and filesystem, but sending all user interactions and display over the internet to be shown on your computer. X forwarding allows my to run visual diagnostic tools like kdirstat, or even pull up my home photo management program (fspot) without needing to install a local copy, or connect to the remote disk and deal with those complexities.

Typical X Forwarding Use Case

Let's image for a moment you just want to browse the remote filesystem with dolphin.

  • The XYC flags will enable X forwarding, compress the communication, and enables "trusted" X Forwarding:
    ssh server01 -XYC
    
  • Run your program, for example kdirstat / This command will run kdirstat using the memory, cpu, etc of server01, but the display will be shown, and interact with the mouse and keyboard of the client.

Multiple hop X Forwarding

Unfortunately it's not as easy to chain X11 forwarding as it is to chain normal SSH connections. The workaround is to use SSH tunneling. The general strategy is to create an SSH tunnel which you can open a second SSH connection with.

  • TERMINAL 1:
    ssh server01 -L2200:server02:22
    
  • TERMINAL 2:
    ssh localhost -XYC -p2200 kdirstat /
    

Using these commands in two terminal windows (the first one will just be a normal SSH connection to server01 that you will need to leave open) will open kdirstat / using the CPU, memory, etc of server02, on the display of the original client, as desired.

Also available in: Atom PDF