SSH2 X display forwarding

  toucheatout  2007-02-23 14:23  

This yet another simple feature that can change one's life on certain occasions, when a GUI is mandatory for a task.
To use X forwarding over a secure ssh connexion, there are 2 steps : configure the ssh server to allow it, and instruct ssh to use it when connecting.
The drawback on a server is that you will have to install a working X Window system to use the feature, and that can be quite heavy.

Configure sshd to accept X forwarding

Get to the configuration file /etc/ssh/sshd_config and locate the following directives that control the behavior of X forwarding over ssh:

X11Forwarding no
X11DisplayOffset 10

To effectively be able to login using the feature, turn the first line to

X11Forwarding yes

The second directive, X11DisplayOffset determines which display you will be using when logging in via ssh. In this (default) case, the display to be used will be :10.

Use software over X forwarded display

Simply use ssh with the -X option (or make it permanent and augment your .ssh/config entry for the host with ForwardX11).
Security notice: Privileged users on the remote side can monitor whatever happens on the display... But at least the connexion is made on a securely encrypted channel.
The display should be then set to the right value (:10 in our case) and commands issued will use that display (thus displaying on the other end's screen)

One-line remote application launch

Trivial but useful. We consider having a working basic .ssh/config and public keys installed and enabled for the host defined as mox (in doubt see how to configure ssh and public key authentication):
ssh -X mox mozilla
Should bring you a mozilla window over the encrypted channel.

 
Informatics


yro.slashdot.org - Your Rights online


nytimes.com New York Times - International


Informatic headlines