X forwarding to windows

Sometimes you want to access e.g. xmms or any other graphical Linux application on your Windows desktop. If this is the case, X forwarding is what you need!

Preparation

The SSH deamon of the linux system needs to have X11 forwarding activated. This can be achieved by setting the following parameter to yes in the file /etc/ssh/sshd_config:

X11Forwarding yes

Please restart the ssh daemon after that:

# /etc/init.d/sshd restart

Install Cygwin/X

Cygwin/X is a porting of the X server to Windows which requires an installed Cygwin and runs on all Windows version starting from 95. It’s available for free from the official Homepage of the project. By starting the file Setup.exe the installation begins. The selected packages automatically get downloaded from a specified mirror. For our needs besides the packages selected by default we have to additionally select xorg-x11-base (X11) and OpenSSH (Net).

Starting X server

After double clicking the Cygwin icon on the Windows desktop the X server can be started in the Cygwin shell:

me@cygwin ~
$ X -multiwindow &

set DISPLAY variable

In the most cases the environment variable $DISPLAY has to be set:

me@cygwin ~
$ export DISPLAY=localhost:0.0

Setup an SSH connection

Login on the remote Linux box:

me@cygwin ~
$ ssh -Y -l <username> <remote_hostname_or_ip_address>

Start remote X clients

Now an arbitrary X11 application can be started. The program will get executed on the remote Linux machine while the graphical user interface gets displayed on the local Windows system:

username@linuxserver$ xterm &

It’s fun, isn’t it?

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht.