X11 Forwarding with PuTTY
Nov 29, '10 07:30:00AM
Contributed by: m.g.daniel
PuTTY is an open-source, multi-platform SSH, Telnet, Rlogin and serial interface terminal emulation application with a host of configuration items. PuTTY can be operated from a GUI or the command-line. It is currently available for the Mac using the MacPorts environment. X11 forwarding, a tunneling function under SSH, is confused by the Leopard and later X11 DISPLAY string. This can simply be worked around by setting the 'SSH' menu » X display location item, to :0.
The SSH protocol provides a secure (encrypted) data channel between two points commonly used to provide access to interactive sessions but also providing useful functionality in X Window System (X11) tunneling and TCP port forwarding.
With X11 tunneling the target display server is determined from the originating host's DISPLAY data (commonly set and provided as a shell environment variable). This data is essentially a string and contains three delimited parts:
- A host name or IP address,
- A colon and a display number (commonly zero),
- A period and a screen number.
There are meaningful defaults for each if absent. Typically this looks like
the.host.name:0.0
Leopard brought a previously additional, externally supported X Window System package into the official Apple distribution. With that it became somewhat more Mac-like and integrated into the launchd environment allowing X11 applications to be supported without explicit action by the user. As part of that infrastructure the DISPLAY data includes a string interpreted by launchd. This string occurs in the location traditionally used as the host name (or IP address). Typically this looks like
/tmp/launch-j0aS4K/org.x:0
PuTTY during its internal processing attempts to resolve the host name component if present. If absent it defaults to the local host. When processing the X11 DISPLAY data it parses out the host component (/tmp/launch-j0aS4K/org.x in the above example) and then of course fails to resolve that as a host name which results in broken X11 forwarding.
Explicitly providing :0 as display data (on the command-line or in the 'X display location' configuration item) overrides the originating host DISPLAY data and as it does not contain a host component defaults to the local host working around the OS X DISPLAY quirk.
[crarko adds: I haven't tested this one. There is further discussion of this in this thread in the forums.]
Comments (4)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20101125004004268